Skip to content

Check for a new Rust release #310

Check for a new Rust release

Check for a new Rust release #310

name: Check for a new Rust release
on:
# Allow for this to be manually run.
workflow_dispatch:
inputs:
version:
description: 'Rust release version'
type: string
# Run at midnight every day.
schedule:
- cron: '0 0 * * *'
jobs:
check_for_update:
name: Check if there is a new release
env:
version: ${{inputs.version}}
outputs:
release_version: ${{ steps.check.outputs.version }}
runs-on: ubuntu-latest
steps:
- name: Get the latest release tag name
if: env.version == ''
env:
GH_TOKEN: ${{ github.token }}
run: echo "version=$(gh release view --repo rust-lang/rust --json tagName --jq '.tagName')" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- name: Check if we already have the latest release
id: check
run: test -f "recipes-devtools/rust/rust-bin-cross_${version}.bb" || echo "version=${version}" >> "$GITHUB_OUTPUT"
create_pr:
name: Create release PR
needs: check_for_update
if: needs.check_for_update.outputs.release_version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate new files for the release
run: ./build-new-version.sh ${{needs.check_for_update.outputs.release_version}}
- name: Commit new files
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: feature/rust-${{needs.check_for_update.outputs.release_version}}
create_branch: true
commit_message: "Rust ${{needs.check_for_update.outputs.release_version}}"
add_options: '--all'
push_options: '--force'
- name: Create pull request
env:
GH_TOKEN: ${{ github.token }}
run: gh pr create --title "Rust ${{needs.check_for_update.outputs.release_version}}" --body "Automatically generated by update-release.yml"