Skip to content

Commit

Permalink
use semantic release for release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
tddebart committed Nov 30, 2024
1 parent 8234e9f commit 14a6e23
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 13 deletions.
54 changes: 41 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,61 @@ on:

permissions:
contents: write
issues: write
pull-requests: write

jobs:
build:
uses: ./.github/workflows/build.yml
with:
version: ${{ github.event.inputs.version }}

release:
needs: build
runs-on: ubuntu-latest

steps:
- name: Download Build Artifact
uses: actions/download-artifact@v4
- name: Checkout code
uses: actions/checkout@v4
with:
name: ${{ needs.build.outputs.artifact-name }}
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Install dependencies
run: |
bun install
bun add -g semantic-release @semantic-release/github @semantic-release/release-notes-generator
pip install -r requirements.txt
- name: Build and create zip
run: python helpers/build_zip.py
env:
RELEASE_VERSION: ${{ github.event.inputs.version }}

- name: Generate Release Notes
id: release_notes
run: |
NOTES=$(npx semantic-release --dry-run | sed -n '/Release note for version.*:/,/---/p' | sed '$d')
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$NOTES" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.version }}
name: Release ${{ github.event.inputs.version }}
body: ${{ env.RELEASE_NOTES }}
draft: false
prerelease: ${{ github.event.inputs.prerelease }}
files: |
SteamDB-plugin-${{ github.event.inputs.version }}.zip
generate_release_notes: true
files: SteamDB-plugin-${{ github.event.inputs.version }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator"
],
"dryRun": true,
"ci": false
}

0 comments on commit 14a6e23

Please sign in to comment.