From c6b4ec4348ffc91ffbed43f45a6f082668a26e43 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 30 Oct 2023 11:00:37 +0100 Subject: [PATCH] feat: Snapshot schedule (#253) # Motivation We wish to automate updates. There are workflows to update the snsdemo automatically, however there is not (yet) a workflow to make releases regularly, so the nns-dapp does not benefit much from this automated schedule. As an additional motivation, SNSs now have a shorter maximum time in the open state, so if we wish a snapshot to contain open SNSs we need to update reasonably frequently. # Changes - Run the snapshot workflow periodically # Tests - See the "scheduled" release here: https://github.com/dfinity/snsdemo/releases/tag/release-2023-10-27 - Note: This is triggered by pushing this branch rather than waiting for merge to main and then waiting for the schedule. --------- Co-authored-by: Max Murphy --- .github/workflows/snapshot.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 8b5f098e..e65bdfcf 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -2,6 +2,8 @@ name: Create a snapshot image on: push: workflow_dispatch: + schedule: + - cron: '30 3 * * WED' env: GH_TOKEN: ${{ github.token }} TEST_RELEASE_PROCESS: false # Set to true if you wish to exercise github triggers without spending time creating real artefacts. @@ -15,6 +17,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Create snapshot id: snapshot run: | @@ -36,6 +40,20 @@ jobs: run: bin/dfx-stock-test - name: Stop dfx run: dfx stop + - name: Tag if run on a schedule + if: ${{ (github.event_name == 'schedule') || (github.ref_name == 'snapshot-schedule') }} + id: tag + run: | + set -euxo pipefail + tag_name="$(date +release-%Y-%m-%d)" + if git show-ref --tags --verify --quiet "refs/tags/${tag_name}"; + then + echo "There is already a tag for today's release: ${tag_name}" + else + echo "Tagging as '${tag_name}'" + git tag "${tag_name}" + git push origin "refs/tags/${tag_name}" + fi - name: Release uses: ./.github/actions/release with: