Skip to content

ci: fix npm packaging #32

ci: fix npm packaging

ci: fix npm packaging #32

Workflow file for this run

name: Internal - Main - Continuous Integration
on:
push:
branches: [main]
tags: ["*"]
permissions:
actions: read
contents: read
id-token: write
pages: write
security-events: write
statuses: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
uses: ./.github/workflows/__shared-ci.yml
secrets: inherit
permissions:
actions: read
contents: read
security-events: write
statuses: write
# FIXME: This is a workaround for having workflow ref. See https://github.com/orgs/community/discussions/38659
id-token: write
npm-publish:
needs: ci
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup Node.js
uses: hoverkraft-tech/ci-github-nodejs/actions/setup-node@6809332ced7647b3d52300a47d65657283f3395e # 0.16.0
- name: Download package tarball
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: package-tarball
path: .
- name: Publish CLI to npm
run: |
# Write .npmrc file
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
tag="${{ github.ref_name }}"
npm publish hoverkraft-docusaurus-theme-*.tgz --provenance --access public --tag "@hoverkraft/docusaurus-theme@$tag"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy:
if: github.ref_name == github.event.repository.default_branch
name: Deploy website
needs: ci
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.url }}
outputs:
page-url: ${{ steps.deployment.outputs.url }}
steps:
- id: deployment
uses: hoverkraft-tech/ci-github-publish/actions/deploy/github-pages@444e9ffa1cb512752953c411181e68880dee2d70 # 0.12.0
with:
build-path: packages/docs/build
build-artifact-name: build
deploy-checks:
name: Deploy Checks
needs: deploy
uses: hoverkraft-tech/ci-github-publish/.github/workflows/deploy-checks.yml@444e9ffa1cb512752953c411181e68880dee2d70 # 0.12.0
with:
url: ${{ needs.deploy.outputs.page-url }}