Skip to content

Commit

Permalink
Merge pull request #36 from envato/ci_publish
Browse files Browse the repository at this point in the history
Automate publishing to registries with github actions
  • Loading branch information
gbakernet authored Jul 21, 2023
2 parents 9bf2c05 + 1c6f9e8 commit c4f8502
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish package to registries
on:
release:
types: [published]

jobs:
release-github-registry:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@envato'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-npm-registry:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
scope: '@envato'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ If using a version >= 2.0.0, **you need to load the JS snippet on your applicati

The file `clsFixSnippet.ts` contains the snippet. It's being exported as a string. When including the code in your app, make sure it runs _before_ the main cookiebot code.

### To publish
## Publishing

Run
Publishing is automated via GitHub Actions. Trigger with the following steps:

```sh
npm version (patch/minor/major)
npm publish
```
1. Ensure the latest version is tagged in `main`. eg. `git tag -a v1.1.1 -m "1.1.1" && git push origin v1.1.1`
1. Ensure the latest version is committed in the `package.json`. `"version": "1.1.1"`
1. Create a release via the [Github Releases](https://github.com/envato/cookie-consent/releases)
1. Verify the build in [Github Actions](https://github.com/envato/cookie-consent/actions)
1. Verify the package published to [Github Packages](https://github.com/envato/cookie-consent/pkgs/npm/cookie-consent)
1. Verify the package published to [NPM](https://www.npmjs.com/package/@envato/cookie-consent?activeTab=versions)

0 comments on commit c4f8502

Please sign in to comment.