Skip to content

Bump crate versions #14

Bump crate versions

Bump crate versions #14

Workflow file for this run

name: Bump crate versions
on:
workflow_dispatch:
inputs:
pac_bump:
description: 'PAC version bump (none/patch/minor/major)'
required: true
default: 'none'
sync_hal:
description: 'Update PAC dep string in HAL crate (yes/no)'
required: true
default: 'yes'
hal_bump:
description: 'HAL version bump (none/patch/minor/major)'
required: true
default: 'none'
sync_bsp:
description: 'Update HAL dep string in T1 BSP crates (yes/no)'
required: true
default: 'yes'
bsp_bump:
description: 'T1 BSP version bump (none/patch/minor/major)'
required: true
default: 'none'
jobs:
bump-versions:
runs-on: ubuntu-latest
steps:
- name: Set up Rust
run: |
rustup set profile minimal
rustup override set stable
- uses: actions/checkout@v3
- name: Setup
shell: bash
run: |
set -ex
cargo install cargo-workspace2
- name: Bump PAC versions
if: github.event.inputs.pac_bump != 'none'
shell: bash
run: |
set -ex
# Create a fake workspace file for all PACs.
echo "[workspace]" > Cargo.toml
echo "members = [" >> Cargo.toml
for d in pac/*/ ; do echo " \"${d::-1}\"," >> Cargo.toml; done
echo "]" >> Cargo.toml
echo "" >> Cargo.toml
# Create a ws2 query string for all PACs.
pacs=$(for d in pac/*/ ; do echo -n "${d:4:${#d}-5} "; done )
pacs=${pacs::-1} # Trim trailing space
echo "y" | cargo ws2 [ "${pacs}" ] publish ${{ github.event.inputs.pac_bump }}
rm Cargo.toml
- name: Update HAL deps
if: github.event.inputs.sync_hal == 'yes'
uses: ./.github/actions/sync-pac-versions
- name: Bump HAL version
if: github.event.inputs.hal_bump != 'none'
shell: bash
run: |
set -ex
# Create a fake workspace file for the HAL.
echo "[workspace]" > Cargo.toml
echo "members = [" >> Cargo.toml
echo ' "hal",' >> Cargo.toml
echo "]" >> Cargo.toml
echo "" >> Cargo.toml
echo "y" | cargo ws2 [ "atsamd-hal" ] publish ${{ github.event.inputs.hal_bump }}
rm Cargo.toml
- name: Update BSP deps
if: github.event.inputs.sync_bsp == 'yes'
uses: ./.github/actions/sync-bsp-versions
- name: Bump BSP versions
if: github.event.inputs.bsp_bump != 'none'
shell: bash
run: |
set -ex
T1_BOARDS=$(cat crates.json | jq -Mr -c '[.boards | to_entries | map([.key, .value.tier]) | .[] | select(.[1] == 1) | .[0]] | join(" ")')
# Create a fake workspace file for all BSPs.
echo "[workspace]" > Cargo.toml
echo "members = [" >> Cargo.toml
for d in $T1_BOARDS; do echo " \"boards/${d}\"," >> Cargo.toml; done
echo "]" >> Cargo.toml
echo "" >> Cargo.toml
echo "y" | cargo ws2 [ "${T1_BOARDS}" ] publish ${{ github.event.inputs.bsp_bump }}
rm Cargo.toml
- name: Generate patch
shell: bash
run: |
git config user.name atsamd-bot
git config user.email [email protected]
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:
token: ${{ secrets.ATSAMD_BOT }}
commit-message: ${{ github.event.inputs.bump }} bump of crate versions
committer: GitHub <[email protected]>
author: atsamd-bot <[email protected]>
signoff: false
branch: bump-versions
delete-branch: true
title: '[atsamd-bot] Bump crate versions'
body: |
Automated bump of crate versions.
- Workflow launched by `${{ github.actor }}`
- Workflow: [bump-crates.yml][1]
- PAC bump = `${{ github.event.inputs.pac_bump }}`
- HAL bump = `${{ github.event.inputs.hal_bump }}`
- BSP bump = `${{ github.event.inputs.bsp_bump }}`
[1]: https://github.com/atsamd-rs/atsamd/tree/master/.github/workflows
labels: |
automated pr
version-bump
draft: false