chore: v0.3.0 release #78
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Release' | |
on: | |
push: | |
tags: 'v[0-9]+.[0-9]+.[0-9]+' | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Release version (vX.Y.Z)' | |
required: true | |
type: string | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: 'Build & Test' | |
uses: ./.github/workflows/build.yml | |
release: | |
name: 'Release' | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: 'Set tag name' | |
id: tag | |
run: | | |
if [[ "${{ github.event_name }}" = "workflow_dispatch" ]]; then | |
tag="${{ inputs.version }}" | |
else | |
tag="${{ github.ref_name }}" | |
fi | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
- name: 'Create draft release (and upload release artifacts)' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
for dir in $(ls -d1 myrc-*/); do | |
dir="${dir%/}" | |
chmod +x "$dir/myrc" | |
tar -czf "$dir.tar.gz" -C "$dir" myrc | |
done | |
tag="${{ steps.tag.outputs.tag }}" | |
body="$(awk "/## \\[${tag#v}\\]/{flag=1;next}/## \\[/{flag=0}flag" CHANGELOG.md)" | |
gh release create "$tag" --title "myrc $tag" --draft --generate-notes --notes "$body" *.tar.gz | |
# the "$tag" value is incorrect for draft release (the correct one | |
# returns previous gh release command) | |
#- name: 'Publish release' | |
# env: | |
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# run: gh release edit "$tag" --draft=false |