Skip to content

fix changlog content not being rendered as markdown #121

fix changlog content not being rendered as markdown

fix changlog content not being rendered as markdown #121

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Git
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Extract latest changelog entry
id: changelog
run: |
CHANGELOG_FILE="CHANGELOG.md"
if [ ! -f "$CHANGELOG_FILE" ]; then
echo "Error: $CHANGELOG_FILE does not exist."
exit 1
fi
# Use awk to extract the latest changelog entry
CHANGELOG_CONTENT=$(awk '/^### / {if (found) exit; found=1} found' "$CHANGELOG_FILE")
if [ -z "$CHANGELOG_CONTENT" ]; then
echo "Error: Could not extract the latest changelog entry."
exit 1
fi
echo "Extracted changelog content:"
echo "$CHANGELOG_CONTENT"
# Save the changelog content to a temporary file
cat <<EOF > changelog.txt
$CHANGELOG_CONTENT
EOF
# Save the changelog content file path to an environment variable
echo "CHANGELOG_FILE_PATH=$(realpath changelog.txt)" >> $GITHUB_ENV
shell: bash
- name: Create or update annotated tag with changelog
run: |
TAG_NAME="${{ github.ref_name }}"
CHANGELOG_FILE_PATH="${{ env.CHANGELOG_FILE_PATH }}"
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Tag $TAG_NAME already exists. Updating tag message."
git tag -f -a "$TAG_NAME" -F "$CHANGELOG_FILE_PATH"
git push origin -f "$TAG_NAME"
else
git tag -a "$TAG_NAME" -F "$CHANGELOG_FILE_PATH"
git push origin "$TAG_NAME"
fi
- name: Zip Release
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'package.zip'
exclusions: '*.git* *.scss /*style/* /*assets/* /*js/*'
- name: Create Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "package.zip"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
body: ${{ env.CHANGELOG_FILE_PATH }}