forked from dfinity/nns-dapp
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (87 loc) · 3.55 KB
/
update-snsdemo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# A GitHub Actions workflow that regularly checks for new snsdemo commits
# and creates a PR on finding any.
name: Update snsdemo
on:
schedule:
# check for new snsdemo commits weekly
- cron: '30 3 * * FRI'
workflow_dispatch:
push:
branches:
# Run when the development branch for this workflow is updated.
- update-snsdemo
jobs:
update-snsdemo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update to match the snsdemo repo
id: update
run: |
current_release="$(jq -r .defaults.build.config.SNSDEMO_RELEASE dfx.json)"
echo "Current snsdemo release: $current_release"
latest_release=$(curl -sSL https://api.github.com/repos/dfinity/snsdemo/releases/latest | jq .tag_name -r)
echo "Latest snsdemo release: $latest_release"
{
if [ "$current_release" == "$latest_release" ]
then
echo "updated=0"
else
echo "updated=1"
echo "release=$latest_release"
fi
} >> "$GITHUB_OUTPUT"
- name: Get snsdemo repo
uses: actions/checkout@v4
if: ${{ steps.update.outputs.updated == '1' }}
with:
repository: 'dfinity/snsdemo'
path: 'snsdemo'
ref: ${{ steps.update.outputs.release }}
- name: Update snsdemo
if: ${{ steps.update.outputs.updated == '1' }}
run: |
set -x
echo snsdemo needs an update
# Install `didc`
snsdemo/bin/dfx-software-didc-install --release "$(jq -r .defaults.build.config.DIDC_RELEASE dfx.json)"
# Install sponge
sudo apt-get update -yy && sudo apt-get install -yy moreutils && command -v sponge
# Update
./scripts/update-snsdemo --dir ./snsdemo --release "${{ steps.update.outputs.release }}" --verbose
# Show changes
echo "Git status:"
git status
echo "Changes:"
git diff
- name: Create Pull Request
if: ${{ steps.update.outputs.updated == '1' }}
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GIX_CREATE_PR_PAT }}
commit-message: Update snsdemo to ${{ steps.update.outputs.release }}
committer: GitHub <[email protected]>
author: gix-bot <[email protected]>
branch: bot-snsdemo-update
branch-suffix: timestamp
reviewers: mstrasinskis, dskloetd, yhabib
# Note: Please be careful when updating the add-paths field. We have had the snsdemo committed by accident, with a pattern that matches nothing seemingly committing everything.
add-paths: dfx.json
delete-branch: true
title: 'bot: Update snsdemo to ${{ steps.update.outputs.release }}'
body: |
# Motivation
We would like to keep the testing environment, provided by snsdemo, up to date.
# Changes
* Updated `snsdemo` version in `dfx.json`.
* Ensured that the `dfx` version in `dfx.json` matches `snsdemo`.
# Tests
CI should pass.
# Since the this is a scheduled job, a failure won't be shown on any
# PR status. To notify the team, we send a message to our Slack channel on failure.
- name: Notify Slack on failure
uses: dfinity/internet-identity/.github/actions/slack@release-2023-08-28
if: ${{ failure() }}
with:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "snsdemo update failed"