-
Notifications
You must be signed in to change notification settings - Fork 42
58 lines (55 loc) · 2.33 KB
/
update-didc.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
# A GitHub Actions workflow that regularly checks for new `didc` releases
# and creates a PR on new versions.
name: didc Update
on:
schedule:
# check for new `didc` releases daily at 7:30
- cron: '30 7 * * *'
workflow_dispatch:
jobs:
didc-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# First, check `didc` releases (on the candid repo) for a new version.
- name: Check new didc version
id: update
run: |
pwd
find .github/actions
current_didc_release=$(jq -r '.defaults.build.config.DIDC_VERSION' dfx.json)
echo "current didc release '$current_didc_release'"
latest_didc_release=$(curl -sSL https://api.github.com/repos/dfinity/candid/releases/latest | jq .tag_name -r)
echo "latest didc release '$latest_didc_release'"
if [ "$current_didc_release" != "$latest_didc_release" ]
then
echo didc needs an update
sudo apt-get update -yy && sudo apt-get install -yy moreutils && command -v sponge
DIDC_RELEASE="$latest_didc_release" jq '.defaults.build.config.DIDC_VERSION=(env.DIDC_RELEASE)' dfx.json | sponge dfx.json
echo "updated=1" >> "$GITHUB_OUTPUT"
else
echo "updated=0" >> "$GITHUB_OUTPUT"
fi
jq '.defaults.build.config.DIDC_VERSION' dfx.json
# If `dfx.json` was updated, create a PR.
- name: Create Pull Request
if: ${{ steps.update.outputs.updated == '1' }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GIX_BOT_PAT }}
base: main
add-paths: dfx.json
commit-message: Update didc release
committer: GitHub <[email protected]>
author: gix-bot <[email protected]>
branch: bot-didc-update
delete-branch: true
title: 'Update didc release'
# Since 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: "didc update failed"