diff --git a/.github/workflows/bump-t2-bsp.yml b/.github/workflows/bump-t2-bsp.yml new file mode 100644 index 00000000000..9e22b509623 --- /dev/null +++ b/.github/workflows/bump-t2-bsp.yml @@ -0,0 +1,96 @@ +name: Bump crate versions +on: + workflow_dispatch: + inputs: + bsp_name: + description: 'Name of Tier 2 BSP to bump' + required: true + bsp_bump: + description: 'Tier 2 BSP version bump (none/patch/minor/major)' + required: true + default: 'none' + +jobs: + bump-versions: + runs-on: ubuntu-latest + steps: + - name: Set up Rust + run: | + sudo apt-get install python3-pip && pip install tomlkit + rustup set profile minimal + rustup override set stable + - uses: actions/checkout@v4 + with: + ssh-key: ${{ secrets.ATSAMD_BOT_SSH_PRIVKEY }} + - name: Setup + shell: bash + run: | + set -ex + cargo install cargo-edit + + - name: Bump BSP version + if: github.event.inputs.bsp_bump != 'none' + shell: bash + run: | + set -ex + bsp=${{github.event.inputs.bsp_name }} + + if [ ! -d "boards/$bsp" ]; then + echo "BSP $bsp does not exist" + exit 1 + fi + + if jq -r '.boards | to_entries | map(select(.value.tier == 2) | .key) | .[]' crates.json | grep -q $bsp; then + manifest="boards/$bsp/Cargo.toml" + + # Bump the BSP version + cargo set-version --manifest-path $manifest --bump ${{ github.event.inputs.bsp_bump }} + + # Update the changelog + python3 .github/workflows/update_changelog.py "boards/$bsp/" + else + echo "BSP $bsp is not Tier 2." + exit 2 + fi + + - name: Generate patch + shell: bash + run: | + git diff > bump.patch + + - name: Upload diff + uses: actions/upload-artifact@v4 + with: + name: bump.patch + path: bump.patch + + - name: Cleanup + shell: bash + run: | + set -ex + rm bump.patch + + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v6 + with: + commit-message: | + Bump ${{ github.event.input.bsp_name }} (${{ github.event.inputs.bsp_bump }}) + committer: GitHub + author: atsamd-bot + signoff: false + branch: bump-${{ github.event.input.bsp_name }} + delete-branch: true + title: '[atsamd-bot] Bump crate versions' + body: | + Automated bump of Tier 2 BSP. + - Workflow launched by `${{ github.actor }}` + - Workflow: [bump-t2-bsp.yml][1] + - BSP name = `${{ github.event.inputs.bsp_name}}` + - Bump = `${{ github.event.inputs.bsp_bump }}` + + [1]: https://github.com/atsamd-rs/atsamd/tree/master/.github/workflows + labels: | + automated pr + version-bump + draft: false