Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added action to publish to npm on release #175

Merged
merged 11 commits into from
Apr 11, 2024
29 changes: 29 additions & 0 deletions .github/workflows/publish-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish Cookie Policy release

on:
release:
types: [published]

jobs:
build-and-publish:
name: Publish Cookie Policy to NPM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Build Cookie Policy
run: |
yarn install
yarn build
yarn test
- if: ${{ !github.event.release.prerelease }}
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- if: ${{ github.event.release.prerelease }}
run: npm publish --tag next --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@canonical/cookie-policy",
"version": "3.6.2",
"version": "3.6.3",
"description": "A script and style sheet that displays a cookie policy notification",
"main": "build/js/module.js",
"iife": "build/js/cookie-policy.js",
Expand Down
Loading