Skip to content

Commit

Permalink
automate publishing a new release
Browse files Browse the repository at this point in the history
  • Loading branch information
Kemosabert committed Oct 15, 2024
1 parent cfabb8b commit 4f57d95
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build and release
on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
scope: "@aikidosec"

- name: Install dependencies
run: yarn Install

- name: Get the version
id: get_version
run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT

- name: Set the version
run: npm --no-git-tag-version version ${{ steps.get_version.outputs.tag }}

- name: Build the library
run: yarn build

- name: Publish to NPM
run: |
echo "Publishing version ${{ steps.get_version.outputs.tag }} to NPM"
cd build && npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

0 comments on commit 4f57d95

Please sign in to comment.