Skip to content

Commit

Permalink
Setup workflow for releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairnick committed Aug 26, 2024
1 parent 6c6a591 commit 16a8b74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish
on:
push:
tags:
- "*"
- "@webroute/*"

jobs:
publish:
Expand All @@ -16,20 +16,12 @@ jobs:
- uses: pnpm/action-setup@v4
with:
version: 9.1.3
- name: Extract package name
run: |
TAG_NAME="${GITHUB_REF#refs/tags/}"
# Split the tag into two parts by the first slash
PKG_NAME="${TAG_NAME%%/*}"
# Set environment variables for subsequent steps
echo "PKG_NAME=$PKG_NAME" >> $GITHUB_ENV
- name: Install packages
run: pnpm i
- name: Build package
run: pnpm turbo build --filter $PKG_NAME...
- uses: JS-DevTools/npm-publish@v3
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: "packages/${{ env.PKG_NAME }}"
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"check": "turbo check",
"format:pkg-json": "./scripts/common-pkg.mjs && syncpack format",
"test": "CI=1 turbo test",
"clean": "rimraf -g \"./packages/**/dist\" \"./packages/**/node_modules\""
"clean": "rimraf -g \"./packages/**/dist\" \"./packages/**/node_modules\"",
"release": "pnpm build:packages && pnpm changeset publish"
},
"workspaces": [
"docs",
Expand Down

0 comments on commit 16a8b74

Please sign in to comment.