chore: npm audit (#72) #50
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: On Push to main | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
packages: read | |
jobs: | |
tag: | |
name: Tag Build | |
runs-on: ubuntu-latest | |
outputs: | |
commit_sha: ${{ steps.sha.outputs.commit_sha }} | |
steps: | |
- name: Checkout Ref | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.push.after }} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Configure Git | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Tag | |
run: | | |
npx --yes -- lerna version --yes | |
- name: Save commit SHA | |
id: sha | |
run: | | |
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: | |
- tag | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
steps: | |
- name: Checkout Ref | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.tag.outputs.commit_sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Prepare .npmrc file | |
run: | | |
cat > .npmrc <<EOL | |
//registry.npmjs.org/:_authToken=${NPM_TOKEN} | |
EOL | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: Build libraries | |
run: | | |
npx lerna run build --scope=@evolv/react | |
npx lerna run build --scope=@evolv/nextjs | |
- name: Publish to NPM | |
run: | | |
npx lerna publish from-package --yes | |
build-docs: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
needs: | |
- tag | |
steps: | |
- name: Checkout Ref | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ needs.tag.outputs.commit_sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Configure Git | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Install dependencies | |
run: | | |
npm ci | |
- name: Build libraries | |
run: | | |
npx lerna run build --scope=@evolv/react | |
npx lerna run build --scope=@evolv/nextjs | |
- name: Build Docusaurus | |
run: | | |
npx lerna run build --scope=@evolv/react-sdk-docs | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./docs/build | |
deploy-docs: | |
name: Deploy documentation to GitHub Pages | |
runs-on: ubuntu-latest | |
needs: | |
- build-docs | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |