mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
create script to determine build number
What a pain. It turns out that github.run_number is counting the number of times a specific workflow has been run - but that's different for different workflows, so using that won't get us a single tag with all the corresponding build artifacts. And sadly I can't find a simple atomic way to increase a GitHUb repo variable, so I came up with this somewhat convoluted dance, using the the fact that a push to an existing brach that isn't a fast-forward will fail. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3da943dc8a
commit
94c47f64ac
4 changed files with 122 additions and 41 deletions
31
.github/workflows/android.yml
vendored
31
.github/workflows/android.yml
vendored
|
|
@ -17,14 +17,19 @@ jobs:
|
|||
- name: checkout sources
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: create release name
|
||||
id: tag
|
||||
- name: atomically create or retrieve the build number
|
||||
id: build_nr
|
||||
run: |
|
||||
export tag=""
|
||||
export is_latest=false
|
||||
if [ "${{ github.ref_type }}" = "tag" ] ; then tag="${{ github.ref_name }}" ; else tag="latest"; is_latest=true ; fi
|
||||
echo "tag=${tag}" >> $GITHUB_OUTPUT
|
||||
echo "is_latest=${is_latest}" >> $GITHUB_OUTPUT
|
||||
cd .. # check out parallel to subsurface sources
|
||||
url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds"
|
||||
# the clone followed by the pointless push should verify that the password is stored in the config
|
||||
# that way the script doesn't need the password
|
||||
git clone -b main https://github.com/subsurface/nightly-builds
|
||||
cd nightly-builds
|
||||
git remote set-url origin "$url"
|
||||
git push origin main
|
||||
cd ..
|
||||
bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }}
|
||||
|
||||
- name: run build
|
||||
id: build
|
||||
|
|
@ -51,16 +56,20 @@ jobs:
|
|||
git config --global --add safe.directory ${SUBSURFACE_REPO_PATH}/libdivecomputer
|
||||
bash -x ./subsurface/packaging/android/qmake-build.sh
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "today=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
- name: create version number
|
||||
id: version_number
|
||||
run: |
|
||||
latest=$(cat ../nightly-builds/latest-subsurface-buildnumber)
|
||||
today=$(date '+%Y-%m-%d')
|
||||
version="$today.$latest"
|
||||
echo "version=$version" >> $GITHUB_OUTPUT
|
||||
|
||||
# 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${{ steps.date.outputs.today }}.${{ github.run_number }}
|
||||
tag_name: v${{ steps.version_number.outputs.version }}
|
||||
repository: subsurface/nightly-builds
|
||||
token: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
prerelease: false
|
||||
|
|
|
|||
26
.github/workflows/mac.yml
vendored
26
.github/workflows/mac.yml
vendored
|
|
@ -13,6 +13,20 @@ jobs:
|
|||
steps:
|
||||
- name: checkout sources
|
||||
uses: actions/checkout@v1
|
||||
- name: atomically create or retrieve the build number
|
||||
id: build_nr
|
||||
run: |
|
||||
cd .. # check out parallel to subsurface sources
|
||||
url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds"
|
||||
# the clone followed by the pointless push should verify that the password is stored in the config
|
||||
# that way the script doesn't need the password
|
||||
git clone -b main https://github.com/subsurface/nightly-builds
|
||||
cd nightly-builds
|
||||
git remote set-url origin "$url"
|
||||
git push origin main
|
||||
cd ..
|
||||
bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }}
|
||||
|
||||
- name: setup Homebrew
|
||||
run: brew install hidapi libxslt libjpg libmtp create-dmg confuse
|
||||
- name: set our Qt build
|
||||
|
|
@ -40,16 +54,20 @@ jobs:
|
|||
echo "Created $IMG"
|
||||
echo "dmg=$IMG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "today=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
- name: create version number
|
||||
id: version_number
|
||||
run: |
|
||||
latest=$(cat ../nightly-builds/latest-subsurface-buildnumber)
|
||||
today=$(date '+%Y-%m-%d')
|
||||
version="$today.$latest"
|
||||
echo "version=$version" >> $GITHUB_OUTPUT
|
||||
|
||||
# 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${{ steps.date.outputs.today }}.${{ github.run_number }}
|
||||
tag_name: v${{ steps.version_number.outputs.version }}
|
||||
repository: subsurface/nightly-builds
|
||||
token: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
prerelease: false
|
||||
|
|
|
|||
46
.github/workflows/windows.yml
vendored
46
.github/workflows/windows.yml
vendored
|
|
@ -17,29 +17,19 @@ jobs:
|
|||
- name: checkout sources
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: create release name
|
||||
id: tag
|
||||
- name: atomically create or retrieve the build number
|
||||
id: build_nr
|
||||
run: |
|
||||
export tag=""
|
||||
export is_latest=false
|
||||
if [ "${{ github.ref_type }}" = "tag" ]
|
||||
then
|
||||
tag="${{ github.ref_name }}"
|
||||
else
|
||||
tag="latest"
|
||||
is_latest=true
|
||||
fi
|
||||
echo "tag=${tag}" >> $GITHUB_OUTPUT
|
||||
echo "is_latest=${is_latest}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: tag current version as latest if we don't have a tag
|
||||
if: ${{ steps.tag.outputs.is_latest == 'true' }}
|
||||
uses: rickstaa/action-create-tag@v1
|
||||
with:
|
||||
tag: "latest"
|
||||
tag_exists_error: false
|
||||
force_push_tag: true
|
||||
message: "latest commit to allow 'release' uploads"
|
||||
cd .. # check out parallel to subsurface sources
|
||||
url="https://subsurface:${{ secrets.NIGHTLY_BUILDS }}@github.com/subsurface/nightly-builds"
|
||||
# the clone followed by the pointless push should verify that the password is stored in the config
|
||||
# that way the script doesn't need the password
|
||||
git clone -b main https://github.com/subsurface/nightly-builds
|
||||
cd nightly-builds
|
||||
git remote set-url origin "$url"
|
||||
git push origin main
|
||||
cd ..
|
||||
bash -x subsurface/scripts/get-or-create-build-nr.sh ${{ github.sha }}
|
||||
|
||||
- name: get other dependencies
|
||||
env:
|
||||
|
|
@ -58,16 +48,20 @@ jobs:
|
|||
bash -x subsurface/.github/workflows/scripts/windows-in-container-build.sh 2>&1 | tee build.log
|
||||
grep "Built target installer" build.log
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "today=$(date '+%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
- name: create version number
|
||||
id: version_number
|
||||
run: |
|
||||
latest=$(cat ../nightly-builds/latest-subsurface-buildnumber)
|
||||
today=$(date '+%Y-%m-%d')
|
||||
version="$today.$latest"
|
||||
echo "version=$version" >> $GITHUB_OUTPUT
|
||||
|
||||
# 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${{ steps.date.outputs.today }}.${{ github.run_number }}
|
||||
tag_name: v${{ steps.version_number.outputs.version }}
|
||||
repository: subsurface/nightly-builds
|
||||
token: ${{ secrets.NIGHTLY_BUILDS }}
|
||||
prerelease: false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue