Skip to content

Commit 9d48dba

Browse files
committed
Attempting auto-release
1 parent 1a33387 commit 9d48dba

1 file changed

Lines changed: 119 additions & 11 deletions

File tree

.github/workflows/cppcmake.yml

Lines changed: 119 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ name: C/C++ CI
22

33
on:
44
push:
5-
branches:
6-
- master
5+
tags:
6+
- v*.*
77
pull_request:
88
branches:
99
- master
1010

1111
env:
12+
APP_NAME: 'AudioCapture'
1213
LSL_URL: 'https://github.com/sccn/liblsl/releases/download'
1314
LSL_RELEASE: '1.13.0'
1415
LSL_RELEASE_SUFFIX: ''
@@ -24,44 +25,151 @@ jobs:
2425
- windows-latest
2526
- macOS-latest
2627
fail-fast: false
28+
2729
steps:
28-
- uses: actions/checkout@v1
30+
- uses: actions/checkout@v2
31+
2932
- name: CMake version
3033
run: cmake --version
34+
3135
- name: download liblsl (Ubuntu)
36+
if: matrix.os == 'ubuntu-latest'
3237
run: |
38+
echo ${{ github.ref }}
3339
curl -L ${LSL_URL}/${LSL_RELEASE}${LSL_RELEASE_SUFFIX}/liblsl-${LSL_RELEASE}-Linux64-bionic.deb -o liblsl.deb
3440
sudo dpkg -i liblsl.deb
3541
sudo apt install -y qtbase5-dev qtmultimedia5-dev
36-
if: matrix.os == 'ubuntu-latest'
42+
3743
- name: download liblsl (Windows)
44+
if: matrix.os == 'windows-latest'
3845
run: |
3946
Invoke-WebRequest -Uri $Env:LSL_URL/$Env:LSL_RELEASE$Env:LSL_RELEASE_SUFFIX/liblsl-$Env:LSL_RELEASE-Win64.zip -o liblsl.7z
4047
7z x liblsl.7z -oLSL
41-
if: matrix.os == 'windows-latest'
48+
4249
- name: download liblsl (macOS)
50+
if: matrix.os == 'macOS-latest'
4351
run: |
4452
curl -L ${LSL_URL}/${LSL_RELEASE}${LSL_RELEASE_SUFFIX}/liblsl-${LSL_RELEASE}-OSX64.tar.bz2 -o liblsl.tar.bz2
4553
mkdir LSL
4654
tar -xvf liblsl.tar.bz2 -C LSL
4755
brew install qt
4856
echo '::set-env name=CMAKE_PREFIX_PATH::/usr/local/opt/qt'
49-
if: matrix.os == 'macOS-latest'
57+
5058
- name: Install Qt
59+
if: matrix.os == 'windows-latest'
5160
# uses: jurplel/install-qt-action@v2
5261
uses: ouuan/install-qt-action@v2.3.1 # workaround until the aqtinstall timeout is fixed
5362
with:
5463
version: 5.14.0
55-
if: matrix.os == 'windows-latest'
64+
5665
- name: Configure CMake
5766
shell: bash
5867
run: |
5968
cmake -S . -B build -DLSL_INSTALL_ROOT=$PWD/LSL/ -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON -DCPACK_DEBIAN_PACKAGE_DEPENDS=1
60-
- name: make
69+
70+
- name: Make
6171
run: cmake --build build --config Release -j
62-
- name: package
72+
73+
- name: Install
6374
run: cmake --build build --config Release -j --target install
64-
- uses: actions/upload-artifact@master
75+
76+
- name: Package (ubuntu) # TODO: Should work on Windows too?
77+
if: matrix.os == 'ubuntu-latest'
78+
run: cmake --build build --config Release -j --target package
79+
80+
- name: Package (macOS)
81+
if: matrix.os == 'macOS-latest'
82+
run: |
83+
cd build
84+
for app in *.app; do
85+
/usr/local/opt/qt/bin/macdeployqt ${app} -dmg
86+
mv "${app%.app}.dmg" "${app%.app}-${LSL_RELEASE}-MacOS64.dmg"
87+
done
88+
89+
- name: Upload Artifacts (ubuntu)
90+
if: matrix.os == 'ubuntu-latest'
91+
uses: actions/upload-artifact@master
6592
with:
6693
name: pkg-${{ matrix.os }}
67-
path: build/install
94+
path: build/AudioCapture-0.1-Linux64-bionic.deb # TODO: Build path from variables
95+
96+
- name: Upload Artifacts (macOS)
97+
if: matrix.os == 'macOS-latest'
98+
uses: actions/upload-artifact@master
99+
with:
100+
name: pkg-${{ matrix.os }}
101+
path: build/AudioCapture-1.13.0-MacOS64.dmg # TODO: Build path from variables
102+
103+
#- name: Upload Artifacts (windows)
104+
# if: matrix.os == 'windows-latest'
105+
# uses: actions/upload-artifact@master
106+
# with:
107+
# name: pkg-${{ matrix.os }}
108+
# path: build/*.7z # TODO: Build path from variables
109+
110+
release:
111+
needs: build
112+
runs-on: ubuntu-latest
113+
steps:
114+
- name: Create Release
115+
if: startsWith(github.ref, 'refs/tags/')
116+
id: create_release
117+
uses: actions/create-release@v1
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
with:
121+
tag_name: ${{ github.ref }}
122+
release_name: Release ${{ github.ref }}
123+
draft: false
124+
prerelease: false
125+
126+
- name: Download Artifact (ubuntu)
127+
if: startsWith(github.ref, 'refs/tags/')
128+
uses: actions/download-artifact@v1
129+
with:
130+
name: pkg-ubuntu-latest
131+
132+
#- name: Download Artifact (windows)
133+
# if: startsWith(github.ref, 'refs/tags/')
134+
# uses: actions/download-artifact@v1
135+
# with:
136+
# name: pkg-windows-latest
137+
138+
- name: Download Artifact (macOS)
139+
if: startsWith(github.ref, 'refs/tags/')
140+
uses: actions/download-artifact@v1
141+
with:
142+
name: pkg-macOS-latest
143+
144+
- name: Upload Release Asset (ubuntu)
145+
if: startsWith(github.ref, 'refs/tags/')
146+
uses: actions/upload-release-asset@v1
147+
env:
148+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
149+
with:
150+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
151+
asset_path: pkg-ubuntu-latest/AudioCapture-0.1-Linux64-bionic.deb
152+
asset_name: AudioCapture-0.1-Linux64-bionic.deb
153+
asset_content_type: application/vnd.debian.binary-package
154+
155+
- name: Upload Release Asset (macOS)
156+
if: startsWith(github.ref, 'refs/tags/')
157+
uses: actions/upload-release-asset@v1
158+
env:
159+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160+
with:
161+
upload_url: ${{ steps.create_release.outputs.upload_url }}
162+
asset_path: pkg-macOS-latest/AudioCapture-1.13.0-MacOS64.dmg
163+
asset_name: AudioCapture-1.13.0-MacOS64.dmg
164+
asset_content_type: application/octet-stream
165+
166+
#- name: Upload Release Asset (windows)
167+
# if: startsWith(github.ref, 'refs/tags/')
168+
# uses: actions/upload-release-asset@v1
169+
# env:
170+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
171+
# with:
172+
# upload_url: ${{ steps.create_release.outputs.upload_url }}
173+
# asset_path: pkg-windows-latest/*.7z
174+
# asset_name: *.7z
175+
# asset_content_type: application/x-7z-compressed

0 commit comments

Comments
 (0)