Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
update changesets flow
Browse files Browse the repository at this point in the history
  • Loading branch information
stevensJourney committed Nov 13, 2023
1 parent 9170c4a commit ddc0bd2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: Setup PNPM
run: |
npm install -g pnpm
npm install -g pnpm@8
echo "PNPM version: $(pnpm -v)"
echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/dev-packages.yaml

This file was deleted.

38 changes: 30 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ on:
push:
branches:
- main
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- name: Checkout Repo
uses: actions/checkout@v3
Expand All @@ -19,20 +24,37 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 20

- name: Setup PNPM
run: |
npm install -g pnpm
npm install -g pnpm@8
- name: Install Dependencies
run: pnpm
run: pnpm install --frozen-lockfile

- name: Build packages
run: pnpm build:packages

- id: is_dev
run: |
IS_DEV=${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/changeset-release/main' }}
echo "value=$IS_DEV" >> $GITHUB_OUTPUT
- name: Publish dev packages
if: ${{ steps.is_dev.outputs.value == 'true' }}
run: |
pnpm changeset version --no-git-tag --snapshot dev
pnpm changeset publish --tag next
- name: Create Release Pull Request or Publish to npm
if: ${{ steps.is_dev.outputs.value == 'false' }}
id: changesets
uses: changesets/action@v1
with:
# 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 }}
version: pnpm ci:version
commit: 'chore: update versions'
title: '[Chore] update versions'

- name: Publish production components.
if: ${{ github.ref == 'refs/heads/main' && steps.changesets.outputs.hasChangesets == 'false' }}
run: pnpm ci:publish
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"scripts": {
"build:all": "pnpm run -r build",
"build:packages": "pnpm run --filter './packages/**' -r build",
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
"ci:publish": "changeset publish && git push --follow-tags",
"clean": "pnpm run -r clean",
"release": "pnpm build:packages && pnpm changeset publish",
"watch": "pnpm run --parallel watch"
},
"keywords": [],
Expand Down

0 comments on commit ddc0bd2

Please sign in to comment.