From 30691e5bf56984ce11cca3a122de597615820a4f Mon Sep 17 00:00:00 2001 From: traunts <73866773+traunts@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:11:51 +1030 Subject: [PATCH 1/3] ci: rename workflows for better grouping/clarity --- .github/workflows/nightly.yaml | 2 +- .github/workflows/release.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 1f21ddb90d..c0f2e3ef92 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -1,4 +1,4 @@ -name: Nightly Development Build and Release +name: Nightly (Development) Build and Release # Controls when the action will run. on: workflow_dispatch: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 527fb3014e..b2790906e4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Build and Release +name: Master Build and Release # Controls when the action will run. on: workflow_dispatch: From 3de9c9087fdd7271e315b51f5dec87bb0888a262 Mon Sep 17 00:00:00 2001 From: traunts <73866773+traunts@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:20:47 +1030 Subject: [PATCH 2/3] chore(build): only checkout code and check tags if the nightly build wasn't dispatched manually --- .github/workflows/nightly.yaml | 41 +++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index c0f2e3ef92..e101d9055f 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -19,33 +19,44 @@ jobs: runs-on: ubuntu-latest outputs: - needs_build: ${{ steps.check_build.outputs.needs_build }} + needs_build: ${{ steps.check_manual_run.outputs.needs_build || steps.check_tags.outputs.needs_build }} steps: + + - name: Check if workflow was manually triggered + id: check_manual_run + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "Workflow dispatched manually. Continuing..." + echo "needs_build=true" >> $GITHUB_OUTPUT; + else + echo "Workflow triggered by a scheduled run. Continuing..." + echo "needs_build=false" >> $GITHUB_OUTPUT; + fi + - name: Checkout code + if: !steps.check_manual_run.outputs.needs_build uses: actions/checkout@v3 - name: fetch tags + if: !steps.check_manual_run.outputs.needs_build run: git fetch --tags origin - name: Check if tags point to the same commit or if the workflow was manually triggered - id: check_build + if: !steps.check_manual_run.outputs.needs_build + id: check_tags run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - echo "Workflow dispatched manually. Continuing..." - echo "needs_build=true" >> $GITHUB_OUTPUT; + curr_sha=$(git rev-parse HEAD) + prev_sha=$(git rev-parse ${{ env.PREV_TAG }}) + + if [[ "$curr_sha" == "$prev_sha" ]]; then + echo "No changes since last nightly release. Exiting..." + echo "needs_build=false" >> $GITHUB_OUTPUT; else - curr_sha=$(git rev-parse HEAD) - prev_sha=$(git rev-parse ${{ env.PREV_TAG }}) - - if [[ "$curr_sha" == "$prev_sha" ]]; then - echo "No changes since last nightly release. Exiting..." - echo "needs_build=false" >> $GITHUB_OUTPUT; - else - echo "Changes since last nightly release detected. Continuing..." - echo "needs_build=true" >> $GITHUB_OUTPUT; - fi + echo "Changes since last nightly release detected. Continuing..." + echo "needs_build=true" >> $GITHUB_OUTPUT; fi + build-meson-releases: name: Linux & macOS Release Builds From c2d3f6e28f2dfe37d45e6ed28cfe5526d8ce2cfe Mon Sep 17 00:00:00 2001 From: traunts <73866773+traunts@users.noreply.github.com> Date: Mon, 15 Jan 2024 12:46:39 +1030 Subject: [PATCH 3/3] fix: handle unresolved nightly tag on first nightly release run --- .github/workflows/nightly.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index e101d9055f..b36dcc19ff 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -47,9 +47,12 @@ jobs: id: check_tags run: | curr_sha=$(git rev-parse HEAD) - prev_sha=$(git rev-parse ${{ env.PREV_TAG }}) + prev_sha=$(git rev-parse ${{ env.PREV_TAG }} 2>/dev/null) - if [[ "$curr_sha" == "$prev_sha" ]]; then + if [[ $? -ne 0 ]]; then + echo "Tag ${{ env.PREV_TAG }} cannot be resolved. Continuing..." + echo "needs_build=true" >> $GITHUB_OUTPUT; + elif [[ "$curr_sha" == "$prev_sha" ]]; then echo "No changes since last nightly release. Exiting..." echo "needs_build=false" >> $GITHUB_OUTPUT; else