Release package #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release package | |
on: | |
workflow_dispatch: | |
inputs: | |
release-level: | |
description: 'Release level (one of): patch or minor' | |
required: true | |
default: 'minor' | |
permissions: | |
contents: write | |
jobs: | |
release-package: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GHA_BOT_PAT }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
run: npm install && npx playwright install | |
- name: Check code style | |
run: npm run lint | |
- name: Build | |
run: npm run build | |
- name: Run tests | |
run: npm run test:ci | |
- name: Configure git | |
run: | | |
git config --global user.email "${GITHUB_ACTOR_ID}+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions release workflow" | |
- name: Bump release version | |
run: | | |
echo "NEW_VERSION=$(npm --no-git-tag-version version ${RELEASE_LEVEL})" >> ${GITHUB_ENV} | |
echo "RELEASE_TAG=latest" >> ${GITHUB_ENV} | |
env: | |
RELEASE_LEVEL: ${{ github.event.inputs.release-level }} | |
- name: Commit package.json changes and create tag | |
run: | | |
git add "package.json" | |
git commit -m "Released version ${{ env.NEW_VERSION }}." | |
git tag ${{ env.NEW_VERSION }} | |
# - name: Publish | |
# run: npm publish --verbose --access public --tag ${{ env.RELEASE_TAG }} | |
# env: | |
# NODE_AUTH_TOKEN: ${{ secrets.NPMJS_BOT_PAT }} | |
- name: Push changes to repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: git push origin && git push --tags | |
- name: Publish release on GitHub | |
uses: release-drafter/release-drafter@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: ${{ env.NEW_VERSION }} | |
tag: ${{ env.NEW_VERSION }} | |
version: ${{ env.NEW_VERSION }} | |
publish: true |