-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d2bd7e
commit 4639886
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
author: atsamd-bot <[email protected]> | ||
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 |