CD #55
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: CD | |
on: | |
workflow_run: | |
workflows: ['CI'] | |
types: | |
- completed | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: > | |
github.event.workflow_run.conclusion == 'success' && | |
github.event.workflow_run.head_branch == 'main' | |
steps: | |
- name: Checkout and pnpm | |
uses: actions/[email protected] | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
registry-url: 'https://registry.npmjs.org/' | |
node-version: '20.x' | |
cache: pnpm | |
cache-dependency-path: './pnpm-lock.yaml' | |
- name: Install Dependencies | |
run: pnpm i | |
- name: Build | |
run: pnpm freshBuild | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish to npm | |
run: pnpm publish:npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish to GitHub Packages | |
run: pnpm publish:github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |