Skip to content

Commit b074d62

Browse files
committed
Add automatic update workflow
1 parent 2089ae6 commit b074d62

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/update-release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Check for a new Rust release
2+
3+
on:
4+
# Allow for this to be manually run.
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Rust release version'
9+
type: string
10+
required: true
11+
12+
# Run at midnight every day.
13+
schedule:
14+
- cron: '0 0 * * *'
15+
16+
jobs:
17+
check_for_update:
18+
name: Check if there is a new release
19+
env:
20+
version: ${{inputs.version}}
21+
outputs:
22+
release_version: ${{ steps.check.outputs.version }}
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Get the latest release tag name
26+
if: env.version == ''
27+
run: echo "version=$(gh release view --repo rust-lang/rust --json tagName --jq '.tagName')" >> "$GITHUB_ENV"
28+
29+
- uses: actions/checkout@v4
30+
31+
- name: Check if we already have the latest release
32+
id: check
33+
run: test -f "recipes-devtools/rust/rust-bin-cross_${version}.bb" || echo "version=${version}" >> "$GITHUB_OUTPUT"
34+
35+
create_pr:
36+
name: Create release PR
37+
needs: check_for_update
38+
if: needs.check_for_update.outputs.release_version
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Generate new files for the release
44+
run: ./build-new-version.sh ${{needs.check_for_update.outputs.release_version}}
45+
46+
- name: Commit new files
47+
uses: stefanzweifel/git-auto-commit-action@v5
48+
with:
49+
branch: feature/rust-${{needs.check_for_update.outputs.release_version}}
50+
create_branch: true
51+
commit_message: "Rust ${{needs.check_for_update.outputs.release_version}}"
52+
add_options: '--all'
53+
push_options: '--force'
54+
55+
- name: Create pull request
56+
env:
57+
GH_TOKEN: ${{ github.token }}
58+
run: gh pr create --title "Rust ${{needs.check_for_update.outputs.release_version}}" --body "Automatically generated by update-release.yml"

0 commit comments

Comments
 (0)