Skip to content

ci: add release github action #72

ci: add release github action

ci: add release github action #72

Workflow file for this run

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="TODO"
#gh release create "$tag" --draft --generate-notes --notes "$body" *.tar.gz
gh release create "$tag" --draft --generate-notes *.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