Skip to content

Commit

Permalink
feat: Snapshot schedule (#253)
Browse files Browse the repository at this point in the history
# 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 <[email protected]>
  • Loading branch information
bitdivine and bitdivine authored Oct 30, 2023
1 parent a2ebd66 commit c6b4ec4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -15,6 +17,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create snapshot
id: snapshot
run: |
Expand All @@ -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:
Expand Down

0 comments on commit c6b4ec4

Please sign in to comment.