Skip to content

Create Release with Changelog #8

Create Release with Changelog

Create Release with Changelog #8

Workflow file for this run

name: Create Release with Changelog
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Extract changelog for the tag
id: changelog
run: |
# Get the current tag
CURRENT_TAG=${GITHUB_REF#refs/tags/}
# Extract changelog for the current tag using awk
CHANGELOG=$(grep -A 1000 "^## \[$CURRENT_TAG\]" CHANGELOG.md | sed -n '/^## \[v0.2.0\]/,/^<a name/{p}' | sed '$d')
# Handle no match (e.g., if the tag isn't in the changelog)
if [[ -z "$CHANGELOG" ]]; then
echo "Changelog for ${CURRENT_TAG} not found. Please ensure CHANGELOG.md is updated."
exit 1
fi
echo "CHANGELOG_CONTENT<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Step 3: Create a GitHub Release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
permissions:

Check failure on line 42 in .github/workflows/release.yaml

View workflow run for this annotation

GitHub Actions / Create Release with Changelog

Invalid workflow file

The workflow is not valid. .github/workflows/release.yaml (Line: 42, Col: 9): Unexpected value 'permissions'
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: ${{ env.CHANGELOG_CONTENT }}
draft: false
prerelease: false