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