Publish packages (#97) #268
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: Publish packages to npm | |
on: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
TURBO_REMOTE_ONLY: true | |
jobs: | |
test: | |
name: ⬣, 🔎, 🔨 Test before releasing | |
uses: ./.github/workflows/build-and-test.yml | |
secrets: inherit | |
publish: | |
name: 🚀 Release packages | |
needs: [test] | |
runs-on: [ubuntu-latest] | |
permissions: | |
contents: write | |
id-token: write | |
strategy: | |
matrix: | |
node-version: ["18.x"] | |
pnpm-version: ["8.x"] | |
if: ${{ contains(github.event.head_commit.message, '[bump]') || contains(github.event.head_commit.message, 'Publish packages') }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Use pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: ${{ matrix.pnpm-version }} | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Update npm | |
run: npm i -g npm@9 | |
- name: Install dependencies | |
run: pnpm install | |
- name: Publish to npm | |
uses: changesets/action@v1 | |
with: | |
commit: "Publish packages" | |
title: "Publish packages" | |
publish: pnpm publish-packages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |