2022-06-15 05:25:05 +02:00
|
|
|
name: Open a release PR
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
crate:
|
|
|
|
description: Crate to release
|
|
|
|
required: true
|
|
|
|
type: choice
|
2022-06-16 00:52:20 +02:00
|
|
|
options:
|
2022-06-15 05:25:05 +02:00
|
|
|
- cli
|
|
|
|
- lib
|
|
|
|
- filterer-globset
|
|
|
|
- filterer-ignore
|
|
|
|
- filterer-tagged
|
|
|
|
- ignore-files
|
|
|
|
- project-origins
|
|
|
|
version:
|
|
|
|
description: Version to release
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
|
|
|
|
jobs:
|
2022-06-16 00:52:20 +02:00
|
|
|
make-release-pr:
|
2022-06-15 05:25:05 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Install cargo-release
|
|
|
|
uses: baptiste0928/cargo-install@v1
|
|
|
|
with:
|
|
|
|
crate: cargo-release
|
|
|
|
version: "0.21"
|
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: main
|
|
|
|
|
2022-06-16 00:52:20 +02:00
|
|
|
- name: Extract info
|
2022-06-15 05:25:05 +02:00
|
|
|
run: |
|
|
|
|
set -euxo pipefail
|
2022-06-16 00:52:20 +02:00
|
|
|
|
|
|
|
if [[ "${{ inputs.crate }}" == filterer-* ]]; then
|
|
|
|
crate_path="crates/$(tr '-' '/' <<< "${{ inputs.crate }}")"
|
|
|
|
else
|
|
|
|
crate_path="crates/${{ inputs.crate }}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
pushd "$crate_path"
|
2022-06-15 05:25:05 +02:00
|
|
|
crate_name=$(head Cargo.toml -n2 | grep name | cut -d '"' -f2)
|
|
|
|
popd
|
|
|
|
|
2022-06-16 00:52:20 +02:00
|
|
|
branch_name="release-${{ inputs.crate }}-${{ inputs.version }}"
|
|
|
|
|
|
|
|
echo "crate_name=${crate_name}" >> $GITHUB_ENV
|
|
|
|
echo "crate_path=${crate_path}" >> $GITHUB_ENV
|
|
|
|
echo "branch_name=${branch_name}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Make release branch
|
|
|
|
run: git switch -c "${{ env.branch_name }}"
|
|
|
|
|
2022-06-15 05:25:05 +02:00
|
|
|
- name: Do release
|
|
|
|
run: |
|
|
|
|
set -euxo pipefail
|
|
|
|
git config user.name github-actions
|
|
|
|
git config user.email github-actions@github.com
|
|
|
|
cargo release \
|
|
|
|
--execute \
|
|
|
|
--no-push \
|
|
|
|
--no-tag \
|
|
|
|
--no-publish \
|
|
|
|
--no-confirm \
|
|
|
|
--verbose \
|
2022-06-16 00:52:20 +02:00
|
|
|
--config "${{ env.crate_path }}/release.toml" \
|
|
|
|
--allow-branch "${{ env.branch_name }}" \
|
2022-06-16 10:17:04 +02:00
|
|
|
--dependent-version upgrade \
|
2022-06-15 05:25:05 +02:00
|
|
|
--package "${{ env.crate_name }}" \
|
|
|
|
"${{ inputs.version }}"
|
|
|
|
|
|
|
|
- name: Push new branch
|
|
|
|
run: |
|
|
|
|
set -euxo pipefail
|
2022-06-16 00:52:20 +02:00
|
|
|
git push origin "${{ env.branch_name }}"
|
2022-06-15 05:25:05 +02:00
|
|
|
|
2022-06-16 00:52:20 +02:00
|
|
|
- name: Create PR
|
|
|
|
run: |
|
2022-06-15 05:25:05 +02:00
|
|
|
set -euxo pipefail
|
|
|
|
title="release: ${{ inputs.crate }} v${{ inputs.version }}"
|
|
|
|
body="This is a release PR for **${{ inputs.crate }}** to version **${{ inputs.version }}**."
|
|
|
|
if [[ "${{ inputs.crate }}" == "cli" ]]; then
|
|
|
|
body="$body
|
|
|
|
|
|
|
|
Upon merging, this will automatically build the CLI and create a GitHub release. You still need to manually publish the cargo crate."
|
|
|
|
else
|
|
|
|
body="$body
|
|
|
|
|
|
|
|
Upon merging, you will still need to manually publish the cargo crate."
|
|
|
|
fi
|
|
|
|
body="$body
|
|
|
|
|
|
|
|
\`\`\`
|
2022-06-16 10:54:21 +02:00
|
|
|
$ cd crates/${{ env.crate_path }}
|
2022-06-15 05:25:05 +02:00
|
|
|
$ cargo publish
|
|
|
|
\`\`\`
|
|
|
|
|
|
|
|
To merge this release, review the changes then say:
|
|
|
|
|
2022-06-16 10:54:21 +02:00
|
|
|
`bors r+ p=10`
|
2022-06-15 05:25:05 +02:00
|
|
|
|
2022-06-16 10:54:21 +02:00
|
|
|
gh pr create --title "$title" --body "$body" --base main --head "${{ env.branch_name }}" --label "release"
|
2022-06-15 05:25:05 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|