Félix Saparelli 2022-06-15 22:52:20 +00:00 committed by Félix Saparelli
parent 35cf63bc85
commit f21b45e6aa
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
1 changed files with 26 additions and 15 deletions

View File

@ -6,7 +6,7 @@ on:
description: Crate to release
required: true
type: choice
choices:
options:
- cli
- lib
- filterer-globset
@ -20,7 +20,7 @@ on:
type: string
jobs:
make-branch:
make-release-pr:
runs-on: ubuntu-latest
steps:
- name: Install cargo-release
@ -32,17 +32,30 @@ jobs:
- uses: actions/checkout@v2
with:
ref: main
- name: Make branch "release-${{ inputs.crate }}-${{ inputs.version }}"
run: git switch -c "release-${{ inputs.crate }}-${{ inputs.version }}"
- name: Find crate name
- name: Extract info
run: |
set -euxo pipefail
pushd "crates/${{ inputs.crate }}"
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)
echo "crate_name=${crate_name}" >> $GITHUB_ENV
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
@ -55,20 +68,18 @@ jobs:
--no-publish \
--no-confirm \
--verbose \
--allow-branch "release-${{ inputs.crate }}-${{ inputs.version }}"
--config "${{ env.crate_path }}/release.toml" \
--allow-branch "${{ env.branch_name }}" \
--package "${{ env.crate_name }}" \
"${{ inputs.version }}"
- name: Push new branch
run: |
set -euxo pipefail
git push origin "release-${{ inputs.crate }}-${{ inputs.version }}"
git push origin "${{ env.branch_name }}"
make-pr:
runs-on: ubuntu-latest
needs: make-branch
steps:
- run: |
- 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 }}**."
@ -94,7 +105,7 @@ jobs:
bors r+
\`\`\`"
pr_url=$(gh pr create --title "$title" --body "$body" --base main --head "release-${{ inputs.crate }}-${{ inputs.version }}" --label "release")
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 }}