feat: add semantic release #2
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: build-test-publish-on-push | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build-test-publish: | |
env: | |
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
GH_TOKEN: ${{secrets.GH_TOKEN}} | |
GITHUB_TOKEN: ${{secrets.GH_TOKEN}} | |
GH_USER: ${{secrets.GH_USER}} | |
GH_EMAIL: ${{secrets.GH_EMAIL}} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_TOKEN }} | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- run: pnpm add -g pnpm | |
- name: 'Setup Node.js with pnpm cache' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'pnpm' | |
- run: pnpm install | |
- run: pnpm run build | |
- run: pnpm run test | |
- name: 'Setup git coordinates' | |
run: | | |
git remote set-url origin https://${{secrets.GH_USER}}:${{secrets.GH_TOKEN}}@github.com/veramolabs/agent-explorer.git | |
git config user.name $GH_USER | |
git config user.email $GH_EMAIL | |
- name: 'Setup npm registry' | |
run: | | |
echo "registry=https://registry.npmjs.org" > .npmrc | |
echo "@veramo-community:registry=https://registry.npmjs.org" >> .npmrc | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | |
npm whoami | |
- name: 'Publish @latest when on main' | |
if: github.ref == 'refs/heads/main' | |
run: pnpm release |