mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-16 09:08:37 +01:00
112 lines
3.2 KiB
YAML
112 lines
3.2 KiB
YAML
name: Open a release PR
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
crate:
|
|
description: Crate to release
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- cli
|
|
- lib
|
|
- filterer-globset
|
|
- filterer-ignore
|
|
- filterer-tagged
|
|
- ignore-files
|
|
- project-origins
|
|
version:
|
|
description: Version to release
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
make-release-pr:
|
|
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
|
|
|
|
- name: Extract info
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
if [[ "${{ inputs.crate }}" == filterer-* ]]; then
|
|
crate_path="crates/$(tr '-' '/' <<< "${{ inputs.crate }}")"
|
|
else
|
|
crate_path="crates/${{ inputs.crate }}"
|
|
fi
|
|
|
|
pushd "$crate_path"
|
|
crate_name=$(head Cargo.toml -n2 | grep name | cut -d '"' -f2)
|
|
popd
|
|
|
|
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 }}"
|
|
|
|
- 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 \
|
|
--config "${{ env.crate_path }}/release.toml" \
|
|
--allow-branch "${{ env.branch_name }}" \
|
|
--dependent-version upgrade \
|
|
--package "${{ env.crate_name }}" \
|
|
"${{ inputs.version }}"
|
|
|
|
- name: Push new branch
|
|
run: |
|
|
set -euxo pipefail
|
|
git push origin "${{ env.branch_name }}"
|
|
|
|
- name: Create PR
|
|
run: |
|
|
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
|
|
|
|
\`\`\`
|
|
$ cd crates/${{ inputs.crate }}
|
|
$ cargo publish
|
|
\`\`\`
|
|
|
|
To merge this release, review the changes then say:
|
|
|
|
\`\`\`
|
|
bors r+
|
|
\`\`\`"
|
|
|
|
pr_url=$(gh pr create --title "$title" --body "$body" --base main --head "${{ env.branch_name }}" --label "release")
|
|
gh pr comment "$pr_url" --body "bors single on\nbors p=10"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|