Release #22
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
# | |
# This workflow creates a release from a specified branch. The Package version is managed | |
# by Nerdbank Gitversioning based on configuration held in 'version.json' file. | |
# | |
name: Release | |
on: | |
workflow_dispatch: | |
jobs: | |
# Build, Test and Pack the 'cucumber-tsflow' package | |
build: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.set_package_version.outputs.NpmPackageVersion }} | |
releaseTag: ${{ steps.tagInfo.outputs.releaseTag }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# avoid shallow clone (required by Nerbank GitVersioning) | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install npm packages | |
run: npm ci | |
- name: Update package version | |
id: set_package_version | |
uses: dotnet/nbgv@master | |
with: | |
stamp: cucumber-tsflow/package.json | |
- name: Build | |
run: npm run build | |
- name: Create npm package | |
run: npm pack ./cucumber-tsflow | |
- name: Read tag info | |
id: tagInfo | |
run: |- | |
echo "releaseTag=$(jq '.releaseTag // "latest"' version.json)" | tee -a $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: npm-package | |
path: | | |
cucumber-tsflow-${{ steps.set_package_version.outputs.NpmPackageVersion }}.tgz | |
# Publish the 'cucumber-tsflow' package to npm | |
publish: | |
name: Publish to npm | |
runs-on: ubuntu-latest | |
needs: build | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: 'https://registry.npmjs.org' | |
- uses: actions/download-artifact@v2 | |
name: Download npm package | |
with: | |
name: npm-package | |
- name: Publish npm package | |
run: |- | |
npm publish \ | |
cucumber-tsflow-${{ needs.build.outputs.version }}.tgz \ | |
--tag ${{ needs.build.outputs.releaseTag }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ needs.build.outputs.version }} | |
commit: ${{ github.sha }} | |
artifacts: cucumber-tsflow-${{ needs.build.outputs.version }}.tgz | |
generateReleaseNotes: true |