forked from GrandOrgue/grandorgue
-
Notifications
You must be signed in to change notification settings - Fork 0
166 lines (141 loc) · 5.15 KB
/
build.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Build
on: [push]
jobs:
calc_ver:
# calculate versions from git tags
runs-on: ubuntu-latest
outputs:
project_ver: ${{steps.vers.outputs.project_ver}}
build_ver: ${{steps.vers.outputs.build_ver}}
full_ver: ${{steps.vers.outputs.full_ver}}
release_flag: ${{steps.vers.outputs.release_flag}}
release_id: ${{ steps.create_release.outputs.id }}
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Set git tags and compose RELNOTES.md
shell: bash
run: ${{github.workspace}}/build-scripts/for-github/autotag.sh
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') }}
- name: Calculate relnotes file
id: relnotes
shell: bash
run: |
[[ -e RELNOTES.md ]] && RELNOTES_FILE=RELNOTES.md
echo "file=$RELNOTES_FILE" >>$GITHUB_OUTPUT
- name: Calculate versions
id: vers
shell: bash
run: |
git fetch --prune --unshallow --tags || true
GIT_VERSION=`git describe --tags`
PROJECT_VERSION=`echo $GIT_VERSION | cut -d- -f1`
BUILD_VERSION=`echo $GIT_VERSION | cut -d- -f2-3 --output-delimiter=.`
GIT_CHANGE_NUM=`echo $GIT_VERSION | cut -d- -f3`
if [[ -n "$GIT_CHANGE_NUM" ]] || [[ "$BUILD_VERSION" < "1" ]]; then
RELEASE_FLAG=OFF
else
RELEASE_FLAG=ON
fi
echo "project_ver=$PROJECT_VERSION" >>$GITHUB_OUTPUT
echo "build_ver=$BUILD_VERSION" >>$GITHUB_OUTPUT
echo "full_ver=$PROJECT_VERSION-$BUILD_VERSION" >>$GITHUB_OUTPUT
echo "release_flag=$RELEASE_FLAG" >>$GITHUB_OUTPUT
- name: Display versions
run: |
echo "project_ver=${{steps.vers.outputs.project_ver}}"
echo "build_ver=${{steps.vers.outputs.build_ver}}"
echo "full_ver=${{steps.vers.outputs.full_ver}}"
echo "release_flag=${{steps.vers.outputs.release_flag}}"
- name: Create Draft Release
if: ${{ steps.vers.outputs.release_flag == 'ON' }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ steps.vers.outputs.full_ver }}"
release_name: "v${{ steps.vers.outputs.full_ver }}"
draft: true
prerelease: false
body_path: "${{ steps.relnotes.outputs.file }}"
build:
needs: [calc_ver]
strategy:
fail-fast: false
matrix:
include:
- run_on: ubuntu-20.04
for: linux
prepare: "debian-based"
build_on: linux
- run_on: ubuntu-20.04
for: linux
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
- run_on: ubuntu-20.04
for: appimage-x86_64
prepare: "debian-based"
build_on: linux
- run_on: ubuntu-20.04
for: linux-armhf
prepare: "debian-based"
build_on: linux
- run_on: ubuntu-20.04
for: linux-armhf
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
- run_on: ubuntu-20.04
for: linux-aarch64
prepare: "debian-based"
build_on: linux
- run_on: ubuntu-20.04
for: linux-aarch64
prepare: "debian-based"
build_on: linux
pkg_suffix: wx32
- run_on: macos-12 # x86_64
for: osx
prepare: osx
build_on: osx
- run_on: macos-14 # arm64
for: osx
prepare: osx
build_on: osx
- run_on: ubuntu-latest
for: win64
prepare: "debian-based"
build_on: linux
runs-on: ${{ matrix.run_on }}
steps:
- uses: actions/checkout@v4.1.1
with:
submodules: true
- name: Install Dependencies
run: ${{github.workspace}}/build-scripts/for-${{ matrix.for }}/prepare-${{ matrix.prepare }}.sh "${{ matrix.pkg_suffix }}"
- name: Build
working-directory: ${{github.workspace}}
run: ${{github.workspace}}/build-scripts/for-${{ matrix.for }}/build-on-${{ matrix.build_on }}.sh ${{needs.calc_ver.outputs.project_ver}} ${{needs.calc_ver.outputs.build_ver}} ${{github.workspace}} "${{ matrix.pkg_suffix }}"
- name: Upload result
uses: nanoufo/action-upload-artifacts-and-release-assets@v2
with:
path: |
${{github.workspace}}/build/${{ matrix.for }}/grandorgue*${{needs.calc_ver.outputs.full_ver}}*
upload-release-files: ${{ needs.calc_ver.outputs.release_flag }}
release-upload-url: ${{ needs.calc_ver.outputs.release_upload_url }}
if-no-files-found: error
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
needs: [calc_ver, build]
if: ${{ needs.calc_ver.outputs.release_flag == 'ON' }}
runs-on: ubuntu-latest
steps:
- uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.calc_ver.outputs.release_id }}