Skip to content

Release new version #14

Release new version

Release new version #14

name: Release new version
on:
workflow_dispatch:
inputs:
majorRelease:
required: false
description: 'Release as version. Example values are: minor, major, 5.6.1, 1.0.0. Leave empty for regular release.'
tag:
required: false
description: 'Prerelease tag name. Leave empty for regular release.'
jobs:
integration-tests:
uses: ./.github/workflows/integration-tests.yaml
secrets: inherit
publish:
runs-on: ubuntu-latest
needs: integration-tests
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PAT }}
- name: Set up node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install dependencies
run: |
npm install
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Build
run: |
npm run build
- name: Release
run: |
npm run release ${{ github.event.inputs.majorRelease != '' && format('-- --release-as {0}', github.event.inputs.majorRelease) || '' }} ${{ github.event.inputs.tag != '' && format('--prerelease {0}', github.event.inputs.tag) || '' }}
- name: Publish to npm
run: |
echo //registry.npmjs.org/:_authToken=${{secrets.NPM_PUBLISH_KEY}} >> .npmrc
echo email=${{ secrets.NPM_EMAIL }} >> .npmrc
echo always-auth=true >> .npmrc
npm publish ${{ github.event.inputs.tag != '' && format('--tag {0}', github.event.inputs.tag) || '' }}
- name: Push git tags
run: |
git push --follow-tags origin main
- name: Get latest tag
id: tag_generation
run: |
NEW_TAG=$(git describe --tags --abbrev=0)
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
shell: bash
- name: GitHub release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
tag_name: ${{ steps.tag_generation.outputs.new_tag }}