forked from bitcoindevkit/bdk
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (52 loc) · 2.19 KB
/
cron-update-rust.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
name: Update rust version
on:
schedule:
- cron: "0 0 15 * *" # At 00:00 on day-of-month 15.
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update rustc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Update rust-version to use latest stable
run: |
set -x
# Extract the version from whatever version of the compiler dtolnay/rust-toolchain gives us.
RUST_VERSION=$(rustc --verbose --version | sed -ne 's/^release: //p')
# Update the version in the reference file.
echo "${RUST_VERSION}" > rust-version
echo "rust_version=${RUST_VERSION}" >> $GITHUB_ENV
# In case of no new version don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated rustc. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update rustc but the latest stable date did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-token.outputs.token }}
author: Github Action <[email protected]>
committer: Github Action <[email protected]>
branch: create-pull-request/update-rust-version
title: |
ci: automated update to rustc ${{ env.rust_version }}
commit-message: |
ci: automated update to rustc ${{ env.rust_version }}
body: |
Automated update to Github CI workflow `cont_integration.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action