particle-os-cli/.github/workflows/post-release.yml
2024-01-27 16:58:19 -05:00

57 lines
No EOL
1.7 KiB
YAML

name: Post-release version bump
# how to trigger: https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
on:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
ci:
if: github.repository == 'blue-build/cli'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install cargo-release
run: cargo install cargo-release
- name: Git setup
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Setup post-release version bump
run: |
# Read the current version from Cargo.toml
current_version=$(cargo metadata --format-version 1 --no-deps | \
jq --raw-output '.packages | .[] | select(.name == "blue-build").version')
# Sanity check: current version should be 0.X.Y
if ! grep -q '^0\.[0-9]\+\.[0-9]\+$' <<< "${current_version}"; then
echo "Invalid version (not in 0.X.Y format): ${current_version}"
exit 1
fi
minor_version=$(sed 's/^0\.\([0-9]\+\).*/\1/' <<< "${current_version}")
next_version=0.$((minor_version + 1)).0-dev
echo "Bumping version to ${next_version}"
# See release.yml for meaning of these arguments
cargo release "${next_version}" \
--workspace \
--no-publish \
--no-tag \
--no-confirm \
--no-push
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
delete-branch: true
base: "main"
title: "Bump Version after Release"
body: |
Bump version after release
This PR has been auto-generated