didc Update #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' | |
body: | | |
# Motivation | |
A newer version of `didc` is available. | |
# Changes | |
## Changes made by a bot triggered by ${{ github.actor }} | |
- Update the version of `didc` specified in `dfx.json`. | |
## Changes made by a human (delete if inapplicable) | |
# Tests | |
- CI contains tests that detect most breaking changes in `didc`. | |
- [ ] Please check [the didc release notes](https://github.com/dfinity/candid/releases) (if any). | |
- [ ] Please check [the didc git history](https://github.com/dfinity/candid/commits/master/tools/didc) (if reasonably short and understandable). | |
# 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" |