Skip to content

Commit

Permalink
Allow re-building on master using latest tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklul committed May 22, 2024
1 parent 75c75d0 commit 0a09e27
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ jobs:
version: ${{ steps.version.outputs.OUTPUT }}

steps:
- name: Use tag name
- name: Use ref tag name
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: echo "$GITHUB_REF_NAME" > .version

- name: Use latest tag name
if: ${{ github.ref_name == 'master' }}
run: echo "$(git ls-remote --tags --sort="v:refname" "https://github.com/${{ github.repository }}" | tail -n1 | sed 's/.*\///; s/\^{}//')" > .version

- name: Generate version string
id: version
run: |
[ -f .version ] && "OUTPUT=$(cat .version)" >> $GITHUB_OUTPUT || \
[ -s .version ] && "OUTPUT=$(cat .version)" >> $GITHUB_OUTPUT || \
echo "OUTPUT=dev-$(date +%Y.%m.%d)-$(date +%H%M%S)" >> $GITHUB_OUTPUT
build-core:
Expand Down Expand Up @@ -175,7 +179,6 @@ jobs:
steps:
- name: Fail this job
if: ${{ matrix.allow-failure && github.ref_name != 'master' && !startsWith(github.ref, 'refs/tags/') }}
# @TODO when v6 is released master should not be excluded here
run: exit 1

- name: Checkout own repository
Expand Down Expand Up @@ -312,7 +315,6 @@ jobs:
steps:
- name: Fail this job
if: ${{ matrix.allow-failure && github.ref_name != 'master' && !startsWith(github.ref, 'refs/tags/') }}
# @TODO when v6 is released master should not be excluded here
run: exit 1

- name: Checkout own repository
Expand Down Expand Up @@ -385,7 +387,7 @@ jobs:
upload:
concurrency: upload
needs: [build-package]
needs: [set-version, build-package]
runs-on: ubuntu-latest

permissions:
Expand Down Expand Up @@ -437,14 +439,16 @@ jobs:
echo "Web version: $WEB_VERSION_OUT " >> changelog.md
echo "FTL version: $FTL_VERSION_OUT " >> changelog.md
- name: Create a release
- name: Create or Edit a release
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: ${{ startsWith(github.ref, 'refs/tags/') || (github.ref_name == 'master' && !startsWith(needs.set-version.outputs.version, 'dev-')) }}
with:
files: ./artifacts/*/*.ipk
tag_name: ${{ needs.set-version.outputs.version }}
body_path: changelog.md
append_body: true
generate_release_notes: true
draft: true
make_latest: true

- name: Collect new packages
run: |
Expand Down Expand Up @@ -472,7 +476,6 @@ jobs:
- name: Upload packages
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref_name == 'master' }}
# @TODO when v6 is released builds on master should not be allowed to upload
with:
branch: gh-pages
folder: .
Expand Down

0 comments on commit 0a09e27

Please sign in to comment.