Skip to content

Merge pull request #31 from BonnierNews/renovate/mocha-11.x #1

Merge pull request #31 from BonnierNews/renovate/mocha-11.x

Merge pull request #31 from BonnierNews/renovate/mocha-11.x #1

Workflow file for this run

on:
push:
branches:
- main
paths:
- "package.json"
name: Create Release
jobs:
test:
uses: ./.github/workflows/ci.yml
build:
name: Create Release
runs-on: ubuntu-latest
needs: test
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Fetch tags
run: git fetch --prune --unshallow --tags
- name: Check if package version changed
id: check_version
run: |
version="v$(cat package.json | jq -r '.version')"
if [ $(git tag -l "$version") ]; then
echo "Tag $version already exists."
else
echo "version_tag=$version" >> "$GITHUB_OUTPUT"
fi
- uses: actions/setup-node@v4
if: steps.check_version.outputs.version_tag
with:
node-version-file: .nvmrc
cache: npm
registry-url: "https://registry.npmjs.org"
- name: Create GitHub release
if: steps.check_version.outputs.version_tag
run: |
gh release create ${{ steps.check_version.outputs.version_tag }} --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to NPM
if: steps.check_version.outputs.version_tag
run: |
npm ci
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}