chore: publish #675
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: NPM Release | |
on: | |
push: | |
branches: | |
- main | |
env: | |
GITHUB_PAT: "${{ secrets.KIVA_ROBOT_GITHUB_PAT || github.token }}" | |
AWS_REGION: "us-west-2" | |
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}" | |
AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
# 'Automation' type NPM access token used for publishing packages to NPM | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
steps: | |
# Configure npmrc file and node installation | |
- name: Configure Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
# Check that the NODE_AUTH_TOKEN is valid | |
- name: Confirm NPM authentication | |
run: npm whoami | |
# Configure git user access token and fetch latest changes | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
# Required in order to publish all the commits since the last release | |
fetch-depth: 0 | |
# Personal Access Token with the 'public_repo' scope, to allow tagging the latest release | |
token: ${{ secrets.PUBLISH_PAT }} | |
# Checkout shared GitHub Actions workflows | |
- name: Checkout shared workflows | |
uses: actions/checkout@v3 | |
with: | |
repository: kiva/github-actions | |
ref: main | |
token: ${{ env.GITHUB_PAT }} | |
path: .github/ | |
# Configure Git user email and name for the release tags | |
- name: Configure Git user | |
run: | | |
git config --global user.email "ci@kiva.org" | |
git config --global user.name "ci@$GITHUB_ACTOR" | |
# Install dependencies for release scripts | |
- name: Install dependencies | |
run: npm ci | |
# Build projects | |
- name: Build projects | |
run: npm run build | |
# Upload static asssets | |
- name: Upload static assets | |
uses: ./.github/actions/upload-static-assets | |
with: | |
source_dir: "dist/assets" | |
# Reset the git working directory to the last commit before publishing with lerna | |
- name: Reset git working directory | |
run: git reset --hard HEAD | |
# Tag release and publish to NPM | |
- name: Publish release | |
run: npm run publish-release -- --yes --no-verify-access |