Skip to content

Commit

Permalink
Merge pull request #175 from canonical/publish-on-release
Browse files Browse the repository at this point in the history
Added action to publish to npm on release
  • Loading branch information
samhotep committed Apr 11, 2024
2 parents 2b32e1f + 30144ca commit 84b0ae9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
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

0 comments on commit 84b0ae9

Please sign in to comment.