Skip to content

feat: add auth login and access token handling #75

feat: add auth login and access token handling

feat: add auth login and access token handling #75

Workflow file for this run

# semantic-release action
# Derived from https://semantic-release.gitbook.io/semantic-release/recipes/ci-configurations/github-actions
name: release
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read # for checkout
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Install dependencies
run: npm clean-install
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Build
env:
NOVA_AUTH0_DEV_CLIENT_ID: ${{ secrets.NOVA_AUTH0_DEV_CLIENT_ID }}
NOVA_AUTH0_STG_CLIENT_ID: ${{ secrets.NOVA_AUTH0_STG_CLIENT_ID }}
NOVA_AUTH0_PROD_CLIENT_ID: ${{ secrets.NOVA_AUTH0_PROD_CLIENT_ID }}
run: npm run build
build-and-release:
runs-on: ubuntu-latest
needs: setup
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
publish-snapshot:
runs-on: ubuntu-latest
needs: setup
if: github.event_name == 'pull_request'
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure npm authentication
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish snapshot to npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# Extract the pull request number
PR_NUMBER=$(echo $GITHUB_REF | sed 's/refs\/pull\/\([0-9]*\)\/.*/\1/')
# Extract the branch name
BRANCH_NAME=$(echo $GITHUB_HEAD_REF | sed 's/\//-/g')
# Create a snapshot version with branch name and PR number
npm version prerelease --preid=${BRANCH_NAME}-pr-$PR_NUMBER --no-git-tag-version
# Publish the snapshot version
npm publish --tag snapshot