Compare commits

...

7 Commits

Author SHA1 Message Date
Michael Keller
0c315de5ad CICD: Fix GitHub Actions.
Fix the setting of environment variables in the android build.
Also fix a typo in the AppImage build.

Signed-off-by: Michael Keller <mikeller@042.ch>
2024-01-10 13:43:09 -08:00
Dirk Hohndel
cedf2777e6 build-system: remove pointless assignment
Suggested-by: Michael Keller <github@ike.ch>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:36:32 -08:00
Dirk Hohndel
4f72bf38ae build-system: get the buildnr file from the right directory
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:36:32 -08:00
Dirk Hohndel
b7d82da4d9 build-system: correctly test that branch was created
That '-b' was exactly the wrong thing to do here...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:36:32 -08:00
Dirk Hohndel
856218f0b9 build-system: push to origin instead of explicit URL
Otherwise we don't use the embedded credentials and the push fails.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:36:32 -08:00
Dirk Hohndel
402085fa69 build-system: use GitHub Actions outputs
Tempting as it is to think this is just like bash - yaml isn't bash at all.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 13:36:32 -08:00
Dirk Hohndel
257415b512 build-system: don't discard the get-or-create-build-nr script output
That was the whole point of the previous change.
Also, run the build number creation on a pull request as well (at least for a
while) so we don't need to create new releases in order to test that part of
the process).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2024-01-10 12:38:49 -08:00
7 changed files with 31 additions and 16 deletions

View File

@ -26,6 +26,8 @@ jobs:
if: github.event_name == 'push'
run: |
bash scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release"
version=$(<release-version)
echo "version=$version" >> $GITHUB_OUTPUT
- name: store dummy version and build number for non-push build runs
if: github.event_name != 'push'
@ -58,10 +60,10 @@ jobs:
git config --global --add safe.directory $GITHUB_WORKSPACE/libdivecomputer
# get the build number via curl so this works both for a pull request as well as a push
BUILDNR=$(curl -q https://raw.githubusercontent.com/subsurface/nightly-builds/main/latest-subsurface-buildnumber)
OUTPUT_DIR="$GITHUB_WORKSPACE"
KEYSTORE_FILE="$KEYSTORE_FILE"
KEYSTORE_PASSWORD="pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}"
KEYSTORE_ALIAS="${{ secrets.ANDROID_KEYSTORE_ALIAS }}"
export OUTPUT_DIR="$GITHUB_WORKSPACE"
export KEYSTORE_FILE="$KEYSTORE_FILE"
export KEYSTORE_PASSWORD="pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }}"
export KEYSTORE_ALIAS="${{ secrets.ANDROID_KEYSTORE_ALIAS }}"
bash -x ./subsurface/packaging/android/qmake-build.sh -buildnr ${BUILDNR}
# only publish a 'release' on push events (those include merging a PR)
@ -69,7 +71,7 @@ jobs:
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
tag_name: v$(<release-version)
tag_name: v${{ steps.version_number.outputs.version }}
repository: subsurface/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false

View File

@ -22,6 +22,8 @@ jobs:
if: github.event_name == 'push'
run: |
bash scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release"
version=$(<release-version)
echo "version=$version" >> $GITHUB_OUTPUT
- name: store dummy version and build number for pull request
if: github.event_name == 'pull_request'
@ -55,14 +57,14 @@ jobs:
- name: prepare release artifacts
if: github.event_name == 'push'
run: |
mv Subsurface.AppImage Subsurface-v(<release-version).AppImage
mv Subsurface.AppImage Subsurface-v${{ steps.version_number.outputs.version }}.AppImage
# only publish a 'release' on push events (those include merging a PR)
- name: upload binaries
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
tag_name: v$(<release-version)
tag_name: v${{ steps.version_number.outputs.version }}
repository: subsurface/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false

View File

@ -19,6 +19,8 @@ jobs:
if: github.event_name == 'push'
run: |
bash scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release"
version=$(<release-version)
echo "version=$version" >> $GITHUB_OUTPUT
- name: store dummy version and build number for pull request
if: github.event_name == 'pull_request'
@ -40,7 +42,6 @@ jobs:
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export PATH=$QT_ROOT/bin:$PATH
export CMAKE_PREFIX_PATH=$QT_ROOT/lib/cmake
DIR=$(pwd)
# now setup Subsurface with WebKit and build the dependencies, using the generic build script
bash -e -x ./subsurface/scripts/build.sh -desktop -build-with-webkit -release -build-deps -ftdi -prep-only
@ -58,7 +59,7 @@ jobs:
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
tag_name: v$(<release-version)
tag_name: v${{ steps.version_number.outputs.version }}
repository: subsurface/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false

View File

@ -3,6 +3,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -14,17 +17,21 @@ jobs:
- name: checkout sources
uses: actions/checkout@v4
# since we are running this step on a pull request, we will skip build numbers in releases
- name: atomically create or retrieve the build number and assemble release notes
id: version_number
run: |
bash -x ./scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release"
bash scripts/create-releasenotes.sh ${{ github.event.head_commit.id }}
version=$(<release-version)
echo "version=$version" >> $GITHUB_OUTPUT
# ironically, we have to upload a file, otherwise this won't create a release with just the release notes
- name: publish release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
tag_name: v$(<release-version)
tag_name: v${{ steps.version_number.outputs.version }}
repository: subsurface/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false

View File

@ -22,6 +22,9 @@ jobs:
if: github.event_name == 'push'
run: |
bash scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release"
version=$(<release-version)
echo "version=$version" >> $GITHUB_OUTPUT
- name: store dummy version and build number for pull request
if: github.event_name == 'pull_request'
@ -51,7 +54,7 @@ jobs:
if: github.event_name == 'push'
uses: softprops/action-gh-release@v1
with:
tag_name: v$(<release-version)
tag_name: v${{ steps.version_number.outputs.version }}
repository: subsurface/nightly-builds
token: ${{ secrets.NIGHTLY_BUILDS }}
prerelease: false

View File

@ -19,8 +19,8 @@ git remote set-url origin "$url"
git push origin main
echo "build number prior to get-or-create was $(<latest-subsurface-buildnumber)"
cd ..
bash -x subsurface/scripts/get-or-create-build-nr.sh "$1" &> /dev/null
echo "build number after get-or-create is $(<subsurface/latest-subsurface-buildnumber)"
bash -x subsurface/scripts/get-or-create-build-nr.sh "$1"
echo "build number after get-or-create is $(<nightly-builds/latest-subsurface-buildnumber)"
cp nightly-builds/latest-subsurface-buildnumber subsurface
[[ -n $3 ]] && echo "$3" > subsurface/latest-subsurface-buildnumber-extension
bash subsurface/scripts/get-version > subsurface/release-version

View File

@ -33,13 +33,13 @@ else
# now comes the moment of truth - are we the first one?
# the push will succeed for exactly one of the workflows
if git push https://github.com/subsurface/nightly-builds "$SHA_BRANCH"
if git push origin "$SHA_BRANCH"
then
# yay - we win! now let's make sure that we remember this number for next time
git checkout main
echo $latest > latest-subsurface-buildnumber
git commit -a -m "record latest build number in main branch"
if ! git push https://github.com/subsurface/nightly-builds main
if ! git push origin main
then
echo "push to main failed - we'll lose monotonic property"
exit 1
@ -48,7 +48,7 @@ else
# someone else was faster - get the number they wrote
git checkout main &> /dev/null
git branch -D "$SHA_BRANCH" &> /dev/null
if ! git checkout -b "$SHA_BRANCH" &> /dev/null
if ! git checkout "$SHA_BRANCH" &> /dev/null
then
echo "push to $SHA_BRANCH failed, but switching to it failed as well"
exit 2