Build and release #124
Workflow file for this run
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 and release | |
on: | |
release: | |
types: [created] | |
jobs: | |
run-unit-tests: | |
uses: ./.github/workflows/unit-test.yml | |
run-end-to-end-tests: | |
uses: ./.github/workflows/end-to-end-tests.yml | |
run-benchmarks: | |
uses: ./.github/workflows/benchmark.yml | |
build: | |
needs: | |
- run-unit-tests | |
- run-end-to-end-tests | |
- run-benchmarks | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18.x" | |
registry-url: "https://registry.npmjs.org" | |
scope: "@aikidosec" | |
- name: Install dependencies | |
run: npm run install-lib-only | |
- name: Get the version | |
id: get_version | |
run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
- name: Set the version | |
run: cd library && npm --no-git-tag-version version ${{ steps.get_version.outputs.tag }} | |
- name: Build the library | |
run: npm run build | |
- name: Linting | |
run: npm run lint | |
- name: Publish to NPM | |
run: | | |
if [ "${{ github.event.release.prerelease }}" = "true" ]; then | |
echo "Publishing beta version ${{ steps.get_version.outputs.tag }} to NPM" | |
cd build && npm publish --provenance --access public --tag beta | |
else | |
echo "Publishing version ${{ steps.get_version.outputs.tag }} to NPM" | |
cd build && npm publish --provenance --access public | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |