tiavina-mika publish to npm π #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# doc: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Publish Package to npmjs | |
run-name: ${{ github.actor }} publish to npm π | |
# on: | |
# release: | |
# types: [published] | |
on: | |
push: | |
branches: | |
# Change this if your primary branch is not main | |
- main | |
- develop | |
permissions: | |
contents: read # for checkout | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: Grim #your environment name | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
steps: | |
- uses: actions/checkout@v4 | |
# need this for using yarn | |
- name: Enable Corepack | |
run: corepack enable | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
# instead of using the local cache in .yarn folder, since it's in .gitignore | |
cache: 'yarn' | |
- run: yarn | |
# for Yarn v1, use `yarn publish` instead | |
# - run: yarn npm publish // if using yarn | |
# - name: Install semantic-release | |
# run: yarn add -g semantic-release @semantic-release/gitlab @semantic-release/changelog @semantic-release/git @semantic-release/npm @semantic-release/commit-analyzer conventional-changelog-conventionalcommits | |
- name: Release | |
env: | |
# this will be used in .yarnrc.yml | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release |