Skip to content

Feat/automate new version #2

Feat/automate new version

Feat/automate new version #2

name: Build and release
on:
release:
types: [created]
pull_request:
branches:
- '*'
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"
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build the library
run: yarn build
- 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: 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 }}