Check Bitcoin Canister Release Update #617
This file contains hidden or 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
name: Check Bitcoin Canister Release Update | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * *" # Runs at UTC midnight every day | ||
env: | ||
# When getting Rust dependencies, retry on network error: | ||
CARGO_NET_RETRY: 10 | ||
# Use the local .curlrc | ||
CURL_HOME: . | ||
# Disable DFX telemetry | ||
DFX_TELEMETRY: 'off' | ||
jobs: | ||
check-update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout dfx repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install script dependencies | ||
run: sudo apt-get install -y moreutils | ||
- name: Create GitHub App Token | ||
uses: actions/create-github-app-token@v2 | ||
id: app-token | ||
with: | ||
app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} | ||
private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | ||
- name: Fetch Bitcoin Canister latest release tag | ||
env: | ||
GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: | | ||
LATEST_TAG=$(gh release view --repo dfinity/bitcoin-canister --json tagName -q .tagName) | ||
echo "Latest tag is $LATEST_TAG" | ||
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV | ||
- name: Check if the latest release tag has been updated | ||
run: | | ||
CURRENT_TAG=$(jq -r '.commmon."ic-btc-canister".version' src/dfx/assets/dfx-asset-sources.json) | ||
echo "Current tag is $CURRENT_TAG" | ||
if [[ "$CURRENT_TAG" == "$LATEST_TAG" ]]; then | ||
echo "No update is required." | ||
exit 1 | ||
else | ||
echo "An update is required." | ||
fi | ||
- name: Update sources to use the latest bitcoin canister version | ||
run: ./scripts/update-btc-canister.sh "$LATEST_TAG" | ||
- name: Create GitHub App Token | ||
uses: actions/create-github-app-token@v2 | ||
id: app-token | ||
Check failure on line 60 in .github/workflows/bitcoin-canister-update.yml
|
||
with: | ||
app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} | ||
private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | ||
- name: Create PR | ||
env: | ||
GH_TOKEN: "${{ steps.app-token.outputs.token }}" | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git checkout -b bot/update-bitcoin-canister/$LATEST_TAG | ||
git add . | ||
git commit -m "Update Bitcoin Canister to $LATEST_TAG" | ||
git push --set-upstream origin bot/update-bitcoin-canister/$LATEST_TAG | ||
PR_TITLE="chore: Update Bitcoin Canister Version to $LATEST_TAG" | ||
PR_BODY="This PR updates the Bitcoin Canister version to the latest tag: $LATEST_TAG" | ||
gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base master --head $(git branch --show-current) |