Skip to content

Release

Release #25

Workflow file for this run

name: Release
on:
release:
types:
- published
permissions:
contents: write
packages: write
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# pnpm should be preinstalled before the setup-node action
# https://github.com/actions/setup-node/issues/530#issuecomment-1169317505
- name: Install pnpm
uses: pnpm/action-setup@v3
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- name: Bump the package version
run: |
pnpm version --no-git-tag-version from-git
- name: Commit the package version
uses: EndBug/add-and-commit@v9
with:
add: 'package.json'
message: 'CI: bumps version to ${{ github.ref_name }}'
push: origin HEAD:main
release:
needs:
- bump-version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
# pnpm should be preinstalled before the setup-node action
# https://github.com/actions/setup-node/issues/530#issuecomment-1169317505
- name: Install pnpm
uses: pnpm/action-setup@v3
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Release to GitHub Package Registry
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
registry: "https://npm.pkg.github.com"
update-changelog:
needs:
- release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Get Previous tag
id: previous-tag
run: |
tag=`gh release list --exclude-pre-releases --exclude-drafts --limit 2 | sed -n '2 p' | awk '{print $(NF -1);}'`
echo "$tag"
echo "TAG=$tag" >> $GITHUB_OUTPUT
- name: Build Changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
configuration: ".github/changelog-config.json"
fromTag: ${{ steps.previous-tag.outputs.TAG }}
toTag: ${{ github.event.release.tag_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}