diff --git a/.github/workflows/publish-on-release.yml b/.github/workflows/publish-on-release.yml new file mode 100644 index 00000000..03bd0670 --- /dev/null +++ b/.github/workflows/publish-on-release.yml @@ -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}} diff --git a/package.json b/package.json index f32393d5..6db6541d 100644 --- a/package.json +++ b/package.json @@ -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",