From fd37fdde93009a26fa664b0844988505af327538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Tue, 16 Sep 2025 14:09:15 +0200 Subject: [PATCH] :paperclip: Add release action workflow --- .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..c7d3c4ac3e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag to release' + required: true + type: string + +permissions: + contents: write + +jobs: + get-release-notes: + environment: release-admins + runs-on: ubuntu-latest + outputs: + release_notes: ${{ steps.extract.outputs.release_notes }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Extract release notes from CHANGES.md + id: extract + run: | + TAG="${{ github.event.inputs.tag }}" + # Extract lines between headers "## $TAG" and next "## " + RELEASE_NOTES=$(awk "/^## $TAG$/{flag=1; next} /^## /{flag=0} flag" CHANGES.md | awk '{$1=$1};1') + # Fallback if nothing found + if [ -z "$RELEASE_NOTES" ]; then + RELEASE_NOTES="No changes for $TAG according to CHANGES.md" + fi + echo "release_notes<> $GITHUB_OUTPUT + echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + create-release: + environment: release-admins + needs: + - get-release-notes + runs-on: ubuntu-latest + steps: + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.event.inputs.tag }} + name: ${{ github.event.inputs.tag }} + body: ${{ needs.get-release-notes.outputs.release_notes }}