Skip to content

Commit 6cac8cd

Browse files
authored
workflow reworked
- Replace unmaintained actions which used deprecated functions (Node.js 12, "set-output"), they may stop working soon: - https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/ - https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ - Remove all hardcoded version numbers: To trigger a release, push a tag that starts with 'v', e.g. 'v1.1'. The release and filenames will be named accordingly (with the 'v' stripped from filenames, e.g. 'gx_plugins_1.1_src.atr.bz2') - Disable 'Latest' tag Normal pushes (without a tag) will create pre-releases named after its branch, e.g. 'master'. 'Latest' only pointed to the latest workflow-run, and could even refer to older codebases. - This code is heavily based on the workflow file from the Aether project https://github.com/Dougal-s/Aether/blob/master/.github/workflows/build.yml
1 parent 3be9fd7 commit 6cac8cd

File tree

1 file changed

+118
-59
lines changed

1 file changed

+118
-59
lines changed

.github/workflows/build.yml

Lines changed: 118 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,84 @@
11
name: build
22

33
on: [push]
4+
#on:
5+
# push:
6+
# tags:
7+
# - 'v*'
48

5-
env:
6-
VERSION: "1.0"
9+
defaults:
10+
run:
11+
shell: bash
712

813
jobs:
9-
build:
14+
####################
15+
create-source-archive:
16+
runs-on: ubuntu-20.04
17+
1018
outputs:
11-
upload_url: ${{ steps.create_release.outputs.upload_url }}
19+
artifact-name: ${{ env.ARCHIVE_NAME }}
20+
21+
steps:
22+
- name: Check out sources
23+
uses: actions/checkout@v3.3.0
24+
with:
25+
path: GxPlugins.lv2
26+
submodules: recursive
27+
28+
- name: create source package
29+
run: tar --exclude=.git* -cjf GxPlugins.tar.bz2 GxPlugins.lv2
30+
31+
- name: Set Archive Name
32+
run: echo "ARCHIVE_NAME=gxplugins-source-code" >> "$GITHUB_ENV"
1233

34+
- uses: actions/upload-artifact@v3.1.2
35+
with:
36+
name: ${{ env.ARCHIVE_NAME }}
37+
path: GxPlugins.tar.bz2
38+
39+
####################
40+
build-linux:
1341
runs-on: ubuntu-latest
1442

43+
outputs:
44+
artifact-name: ${{ env.ARCHIVE_NAME }}
45+
1546
steps:
16-
- name: remove tag
17-
uses: dev-drprasad/delete-tag-and-release@master
47+
- name: Check out sources
48+
uses: actions/checkout@v3.3.0
1849
with:
19-
delete_release: false
20-
tag_name: Latest
21-
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23-
- uses: actions/checkout@master
24-
- name: submodule update
25-
run: git submodule update --init
26-
- name: create source package
27-
run: tar -C .. --exclude=.git* -cjf ../GxPlugins.tar.bz2 $(basename $(pwd))
50+
submodules: recursive
51+
2852
- name: install lv2
2953
run: |
3054
sudo apt-get install lv2-dev debhelper fakeroot
3155
- name: build deb
3256
run: dpkg-buildpackage -rfakeroot -uc -us -b
33-
- name: Create Release
34-
id: create_release
35-
uses: actions/create-release@master
36-
env:
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
with:
39-
tag_name: Latest
40-
release_name: Release latest
41-
draft: false
42-
prerelease: true
43-
- name: Upload Release Asset (Source code)
44-
id: upload-release-asset-src
45-
uses: actions/upload-release-asset@master
46-
env:
47-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
with:
49-
upload_url: ${{ steps.create_release.outputs.upload_url }}
50-
asset_path: ../GxPlugins.tar.bz2
51-
asset_name: gxplugins_${{ env.VERSION }}_src.tar.bz2
52-
asset_content_type: application
53-
- name: Upload Release Asset (Debian package)
54-
id: upload-release-asset-deb
55-
uses: actions/upload-release-asset@master
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
- name: copy deb
58+
run: cp ../gxplugins_*_amd64.deb .
59+
60+
- name: Set Archive Name
61+
run: echo "ARCHIVE_NAME=gxplugins-linux" >> "$GITHUB_ENV"
62+
63+
- uses: actions/upload-artifact@v3.1.2
5864
with:
59-
upload_url: ${{ steps.create_release.outputs.upload_url }}
60-
asset_path: ../gxplugins_${{ env.VERSION }}_amd64.deb
61-
asset_name: gxplugins_${{ env.VERSION }}_amd64.deb
62-
asset_content_type: application
65+
name: ${{ env.ARCHIVE_NAME }}
66+
path: gxplugins_*_amd64.deb
6367

64-
build-win:
65-
needs: build
68+
####################
69+
build-windows:
6670
runs-on: windows-latest
71+
6772
defaults:
6873
run:
6974
shell: msys2 {0}
75+
76+
outputs:
77+
artifact-name: ${{ env.ARCHIVE_NAME }}
78+
7079
steps:
71-
- uses: msys2/setup-msys2@v2
80+
- name: Prepare MSys2
81+
uses: msys2/setup-msys2@v2
7282
with:
7383
update: true
7484
install: >-
@@ -81,22 +91,71 @@ jobs:
8191
mingw-w64-x86_64-pkgconf
8292
pkgconf
8393
mingw-w64-x86_64-7zip
84-
- uses: actions/checkout@master
85-
- name: submodule update
86-
run: git submodule update --init
94+
95+
- name: Check out sources
96+
uses: actions/checkout@v3.3.0
97+
with:
98+
submodules: recursive
99+
87100
- name: make
88101
run: make -j && make DESTDIR=$(pwd)/_bin install
89102
- name: add license and readme
90103
run: cp LICENSE README.md _bin~/.lv2/
91104
- name: zip
92105
run: mv _bin~/.lv2 _bin~/lv2 ; cd _bin~ ; 7z a -mx9 ../plugin.7z lv2 ; cd ..
93-
- name: upload
94-
id: upload-release-asset
95-
uses: actions/upload-release-asset@master
96-
env:
97-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106+
107+
- name: Set Archive Name
108+
run: echo "ARCHIVE_NAME=gxplugins-windows" >> "$GITHUB_ENV"
109+
110+
- uses: actions/upload-artifact@v3.1.2
111+
with:
112+
name: ${{ env.ARCHIVE_NAME }}
113+
path: plugin.7z
114+
115+
####################
116+
release:
117+
runs-on: ubuntu-20.04
118+
119+
outputs:
120+
tag-short: ${{ env.TAG_SHORT }}
121+
122+
needs:
123+
- create-source-archive
124+
- build-linux
125+
- build-windows
126+
127+
steps:
128+
- name: Set short tag name
129+
run: |
130+
TAG_SHORT=${{ github.ref_name }} # branch or tag
131+
if [[ ${{ github.ref_type }} == 'tag' ]] \
132+
&& [[ $TAG_SHORT =~ ^v[0-9] ]] ; then
133+
TAG_SHORT=${TAG_SHORT:1} # remove leading 'v' from tag (v1.0 -> 1.0)
134+
fi
135+
echo "TAG_SHORT=$TAG_SHORT" >> "$GITHUB_ENV"
136+
137+
# required?
138+
# - name: Move 'Latest' tag
139+
# uses: richardsimko/update-tag@v1.0.7
140+
# with:
141+
# tag_name: Latest
142+
# env:
143+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144+
145+
- name: Download all artifacts
146+
uses: actions/download-artifact@v3.0.2
147+
148+
- name: Create Archives
149+
run: |
150+
mv gxplugins-source-code/GxPlugins.tar.bz2 ./gxplugins_${{ env.TAG_SHORT }}_src.tar.bz2
151+
mv gxplugins-linux/gxplugins_*_amd64.deb ./gxplugins_${{ env.TAG_SHORT }}_amd64.deb
152+
mv gxplugins-windows/plugin.7z ./gxplugins_${{ env.TAG_SHORT }}_win64.7z
153+
154+
- uses: softprops/action-gh-release@v1
98155
with:
99-
upload_url: ${{ needs.build.outputs.upload_url }}
100-
asset_path: plugin.7z
101-
asset_name: gxplugins_${{ env.VERSION }}_win64.7z
102-
asset_content_type: application
156+
tag_name: ${{ github.ref_name }}
157+
prerelease: true
158+
files: |
159+
gxplugins_${{ env.TAG_SHORT }}_src.tar.bz2
160+
gxplugins_${{ env.TAG_SHORT }}_amd64.deb
161+
gxplugins_${{ env.TAG_SHORT }}_win64.7z

0 commit comments

Comments
 (0)