Skip to content

Commit

Permalink
Make env.release_tag easy to configure in YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
michaliskambi committed May 20, 2024
1 parent 2d62414 commit d03d581
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ name: Build

on: [push, pull_request]

env:
# To which GitHub release tag should we upload artifacts.
# Can be "snapshot" or "vX.Y.Z" (latter when we make stable release).
release_tag: snapshot
#release_tag: vX.Y.Z

defaults:
run:
shell: bash
Expand Down Expand Up @@ -134,15 +140,15 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh auth status
# Releases files in the "snapshot" release.
# Releases files in the GitHub release.
- name: Release Artifacts
if: ${{ github.ref == 'refs/heads/master' }}
run: gh release --repo castle-engine/castle-model-viewer upload snapshot --clobber *.zip *.tar.gz
run: gh release --repo ${{ github.repository }} upload ${{ env.release_tag }} --clobber *.zip *.tar.gz
env:
GH_TOKEN: ${{ github.token }}

update-release-tag:
name: Update Release Tag (make snapshot tag point to the build commit on master branch)
name: Update Release Tag (make release tag point to the build commit on master branch)
runs-on: ubuntu-latest
needs: [release]
steps:
Expand All @@ -151,6 +157,6 @@ jobs:
if: ${{ github.ref == 'refs/heads/master' }}
run: |
# --force allows to overwrite previous tag
git tag --force snapshot
git tag --force ${{ env.release_tag }}
# --force allows to push with overwritten tag
git push --force origin snapshot
git push --force origin ${{ env.release_tag }}

0 comments on commit d03d581

Please sign in to comment.