Skip to content

testing workflow

testing workflow #5

Workflow file for this run

name: Release and Changelog
on:
release:
types: [created]
workflow_dispatch:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Get tag name
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Generate release notes
id: release_notes
uses: actions/github-script@v7
with:
script: |
const tag = process.env.GITHUB_REF_NAME;
const { data: commits } = await github.rest.repos.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 20,
});
const notes = commits.map(c => {
const msg = c.commit.message.split('\n')[0];
const sha = c.sha.substring(0, 7);
const author = c.commit.author.name;
return `- ${msg} (${sha}, by ${author})`;
}).join('\n');
return notes;
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: Release ${{ steps.tag.outputs.tag }}
body: ${{ steps.release_notes.outputs.result }}
- name: Update CHANGELOG.md
run: |
echo "## ${{ steps.tag.outputs.tag }}" >> CHANGELOG.md
echo "" >> CHANGELOG.md
cat <<EOF >> CHANGELOG.md
${{ steps.release_notes.outputs.result }}

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

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yaml

Invalid workflow file

You have an error in your yaml syntax on line 64
EOF
echo "" >> CHANGELOG.md
git add CHANGELOG.md
git commit -m "docs: update CHANGELOG for ${{ steps.tag.outputs.tag }}"
git push origin HEAD:refs/heads/main