New github actions workflow to publish to npm using semver #1
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
name: Release | ||
on: | ||
push: | ||
branches: [main] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18.x" | ||
registry-url: "https://registry.npmjs.org/" | ||
- run: | | ||
git config user.name "GitHub Actions Bot" | ||
git config user.email "<>" | ||
- name: Install dependencies | ||
run: yarn install --immutable --immutable-cache --check-cache | ||
- name: Install semantic-release extra plugins | ||
run: npm install --save-dev @semantic-release/changelog @semantic-release/git | ||
- run: yarn tsc | ||
- run: yarn build | ||
- name: Create .npmrc file | ||
run: | | ||
echo registry=https://registry.npmjs.org/ > .npmrc | ||
echo '//npm.pkg.github.com/:_authToken=${{ secrets.GH_TOKEN }}' >> .npmrc | ||
- name: Release | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release |