name: "Draft new release"
on:
workflow_dispatch:
inputs:
new-version:
type: choice
description: "Which version you'd like to release?"
options:
- major (_.X.X)
- minor (X._.X)
- patch (X.X._)
- rc (X.X.X-rc)
- release (removes rc)
required: true
jobs:
draft-new-release:
name: "Draft a new release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-edit
uses: actions-rs/install@v0.1
with:
crate: cargo-edit
version: latest
- name: Extracting version from input
run: |
VERSION=$(echo "${{github.event.inputs.new-version}}" | sed 's/ (.*)$//')
echo "VER=$VERSION" >> $GITHUB_ENV
- name: Bump new version in TOML files
run: |
OLD_VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "OLD=$OLD_VERSION" >> $GITHUB_ENV
cargo set-version -p simd-json-derive-int --manifest-path=./simd-json-derive-int/Cargo.toml --bump ${{ env.VER }}
cargo set-version -p simd-json-derive --manifest-path=./Cargo.toml --bump ${{ env.VER }}
NEW_VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
# update simd-json-derive-int dependency to bumped version
cargo upgrade --offline --recursive false -p "simd-json-derive-int@$NEW_VERSION"
echo "NEW=$NEW_VERSION" >> $GITHUB_ENV
- name: Create release branch
run: |
git checkout -b release/${{ env.NEW }}
- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email noreply@github.com
- name: Run cargo check
run: |
cargo check --manifest-path=./Cargo.toml
cargo check --manifest-path=./simd-json-derive-int/Cargo.toml
- name: Commit changelog and manifest files
id: make-commit
run: |
git commit -sa -m "Prepare release ${{ env.NEW }}"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Push new branch
run: git push origin release/${{ env.NEW }}
- name: Create pull request
run: |
gh pr create -B main --title "Release-v${{ env.NEW }}" --body "Yay release" --label "Release"
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}