mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-23 05:58:42 +00:00
Use release-meta action instead of parsing commits (#675)
This commit is contained in:
parent
02484327c1
commit
9821caa6d0
4 changed files with 25 additions and 55 deletions
16
.github/scripts/extract-release-notes.sh
vendored
16
.github/scripts/extract-release-notes.sh
vendored
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -euxo pipefail
|
|
||||||
|
|
||||||
release_pr=$(head -n1 <<< "${COMMIT_MESSAGE:-}" | jq -Rr 'split("[()]"; "")[1] // ""')
|
|
||||||
if [[ -z "$release_pr" ]]; then
|
|
||||||
echo "::set-output name=notes_json::null"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
gh \
|
|
||||||
pr --repo "$GITHUB_REPO" \
|
|
||||||
view "$release_pr" \
|
|
||||||
--json body \
|
|
||||||
--jq '"::set-output name=notes_json::\((.body | split("### Release notes")[1] // "") | tojson)"'
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
set -euxo pipefail
|
|
||||||
|
|
||||||
message="$(head -n1 <<< "$COMMIT_MESSAGE")"
|
|
||||||
crate="$(cut -d ' ' -f 2 <<< "${message}")"
|
|
||||||
version="$(cut -d ' ' -f 3 <<< "${message}")"
|
|
||||||
echo "::set-output name=crate::${crate}"
|
|
||||||
echo "::set-output name=version::${version}"
|
|
4
.github/workflows/release-build.yml
vendored
4
.github/workflows/release-build.yml
vendored
|
@ -102,8 +102,8 @@ jobs:
|
||||||
name: Publish release
|
name: Publish release
|
||||||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
|
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ fromJSON(inputs.publish).version }}
|
tag_name: v${{ fromJSON(inputs.publish).version }}
|
||||||
name: ${{ fromJSON(inputs.publish).version }}
|
name: v${{ fromJSON(inputs.publish).version }}
|
||||||
body: ${{ fromJSON(inputs.publish).notes }}
|
body: ${{ fromJSON(inputs.publish).notes }}
|
||||||
append_body: false
|
append_body: false
|
||||||
files: |
|
files: |
|
||||||
|
|
52
.github/workflows/release.yml
vendored
52
.github/workflows/release.yml
vendored
|
@ -1,56 +1,50 @@
|
||||||
name: Release
|
name: On release
|
||||||
on:
|
on:
|
||||||
push:
|
pull_request:
|
||||||
branches:
|
types: closed
|
||||||
- main
|
branches: [main] # target branch of release PRs
|
||||||
tags-ignore:
|
|
||||||
- "*"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
info:
|
info:
|
||||||
runs-on: ubuntu-latest
|
if: github.event.pull_request.merged
|
||||||
# the commit message will look like: `release: {crate-name} v{version} (#{pr-number})`
|
|
||||||
if: "startsWith(github.event.head_commit.message, 'release: ')"
|
|
||||||
outputs:
|
outputs:
|
||||||
crate: ${{ steps.version.outputs.crate }}
|
is-release: ${{ steps.meta.outputs.is-release }}
|
||||||
version: ${{ steps.version.outputs.version }}
|
crate: ${{ steps.meta.outputs.crate-names }}
|
||||||
notes: ${{ fromJSON(steps.notes.outputs.notes_json) }}
|
version: ${{ steps.meta.outputs.version-actual }}
|
||||||
env:
|
notes: ${{ steps.meta.outputs.notes }}
|
||||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- id: meta
|
||||||
- name: Extract tag from commit message
|
uses: cargo-bins/release-meta@v1
|
||||||
id: version
|
with:
|
||||||
run: .github/scripts/extract-tag-from-release-commit.sh
|
event-data: ${{ toJSON(github.event) }}
|
||||||
- name: Extract release notes
|
extract-notes-under: '### Release notes'
|
||||||
id: notes
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GITHUB_REPO: ${{ github.repository }}
|
|
||||||
run: .github/scripts/extract-release-notes.sh
|
|
||||||
|
|
||||||
tag:
|
tag:
|
||||||
|
if: needs.info.outputs.is-release == 'true'
|
||||||
needs: info
|
needs: info
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Push lib release tag
|
- name: Push lib release tag
|
||||||
if: "! startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
|
if: needs.info.outputs.crate != 'cargo-binstall'
|
||||||
uses: mathieudutour/github-tag-action@v6.1
|
uses: mathieudutour/github-tag-action@v6.1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
custom_tag: ${{ needs.info.outputs.version }}
|
custom_tag: ${{ needs.info.outputs.version }}
|
||||||
tag_prefix: ${{ needs.info.outputs.crate }}-
|
tag_prefix: ${{ needs.info.outputs.crate }}-v
|
||||||
- name: Push cli release tag
|
- name: Push cli release tag
|
||||||
if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
|
if: needs.info.outputs.crate == 'cargo-binstall'
|
||||||
uses: mathieudutour/github-tag-action@v6.1
|
uses: mathieudutour/github-tag-action@v6.1
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
custom_tag: ${{ needs.info.outputs.version }}
|
custom_tag: ${{ needs.info.outputs.version }}
|
||||||
tag_prefix: ''
|
tag_prefix: v
|
||||||
|
|
||||||
package:
|
package:
|
||||||
if: "startsWith(github.event.head_commit.message, 'release: cargo-binstall v')"
|
if: needs.info.outputs.is-release == 'true' && needs.info.outputs.crate == 'cargo-binstall'
|
||||||
needs:
|
needs:
|
||||||
- info
|
- info
|
||||||
- tag
|
- tag
|
||||||
|
|
Loading…
Add table
Reference in a new issue