-
Notifications
You must be signed in to change notification settings - Fork 23
121 lines (111 loc) · 4.93 KB
/
build_and_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Build and Release Composer
# Controls when the workflow will run
on:
# Run on a schedule to get monthly updates
schedule:
- cron: "0 0 28 * *"
# Triggers the workflow on merges to master, release branches,
# all PRs, and release tags
push:
branches:
- master
- '[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+'
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'
- '[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+'
# On anything pull request related
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Note: entire jobs or sections can be disabled by adding
# if: ${{ false }} to the definition column
jobs:
# Determine version
determine_version:
name: Determine the version to be used
runs-on: ubuntu-latest
outputs:
latest_tag_version: ${{ steps.versioning.outputs.latest_tag_version }}
latest_full_tag_version: ${{ steps.versioning.outputs.latest_full_tag_version }}
version_major: ${{ steps.versioning.outputs.version_major }}
version_minor: ${{ steps.versioning.outputs.version_minor }}
version_patch: ${{ steps.versioning.outputs.version_patch }}
version_tweak: ${{ steps.versioning.outputs.version_tweak }}
complete_version: ${{ steps.versioning.outputs.complete_version }}
steps:
- name: Determine the complete version
id: versioning
run: |
# Always check the tags on master since it will have the latest.
# Tags will trigger their own workflow and version names
git clone --recursive ${{ github.server_url }}/${{ github.repository }} performous_composer
cd performous_composer
LATEST_TAG_VERSION=$(git describe --tags --abbrev=0 || echo 1.0.0)
LATEST_FULL_TAG_VERSION=$(git describe --tags || echo 1.0.0)
echo "latest_tag_version=$(git describe --tags --abbrev=0 || echo 1.0.0)" >> $GITHUB_OUTPUT
echo "latest_full_tag_version=$(git describe --tags || echo 1.0.0)" >> $GITHUB_OUTPUT
echo "version_major=$(cut -d '.' -f 1 <<< $(git describe --tags --abbrev=0 || echo 1.0.0))" >> $GITHUB_OUTPUT
echo "version_minor=$(cut -d '.' -f 2 <<< $(git describe --tags --abbrev=0 || echo 1.0.0))" >> $GITHUB_OUTPUT
echo "version_patch=$(cut -d '.' -f 3 <<< $(git describe --tags --abbrev=0 || echo 1.0.0))" >> $GITHUB_OUTPUT
echo "version_tweak=0" >> $GITHUB_OUTPUT
echo "complete_version=$(if [ $GITHUB_REF_TYPE = 'tag' ]; then echo $GITHUB_REF_NAME; elif [ $GITHUB_REF_TYPE = 'branch' ] && [ $GITHUB_REF_NAME = 'master' ]; then echo $LATEST_FULL_TAG_VERSION-beta; elif [ $GITHUB_REF_TYPE = 'branch' ] && [ $GITHUB_REF_NAME != 'master' ]; then echo $LATEST_TAG_VERSION-${{github.event.pull_request.number}}-${GITHUB_SHA::7}-alpha; fi)" >> $GITHUB_OUTPUT
# Set up a release that packages will be published to.
create_release:
name: Create a release
runs-on: ubuntu-latest
# Make sure the output variable for this step is set so it
# can be consumed by later build steps
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create the Main release
id: create_release
if: ${{ github.event_name != 'pull_request' && github.ref_type == 'tag' }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Composer ${{ github.ref_name }}
draft: true
prerelease: false
# Pull in the Linux build workflow
Linux_Packages:
name: Build the Linux packages
uses: ./.github/workflows/linux.yml
with:
package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
release_upload_url: ${{ needs.create_release.outputs.upload_url }}
needs:
- determine_version
- create_release
# Pull in the AppImage build workflow
AppImage_Package:
name: Build the AppImage
uses: ./.github/workflows/appimage.yml
with:
package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
release_upload_url: ${{ needs.create_release.outputs.upload_url }}
needs:
- determine_version
- create_release
# Pull in the MacOS build workflow
#MacOS_Package:
# name: Build the MacOS package
# uses: ./.github/workflows/macos.yml
# with:
# package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
# release_upload_url: ${{ needs.create_release.outputs.upload_url }}
# needs:
# - determine_version
# - create_release
# Pull in the Windows build workflow
#Windows_Packages:
# name: Build the Windows packages
# uses: ./.github/workflows/windows.yml
# with:
# package_complete_version: ${{ needs.determine_version.outputs.complete_version }}
# release_upload_url: ${{ needs.create_release.outputs.upload_url }}
# needs:
# - determine_version
# - create_release