diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3b5b82e..37dc31b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 diff --git a/.github/workflows/dev-packages.yaml b/.github/workflows/dev-packages.yaml deleted file mode 100644 index fa283bb..0000000 --- a/.github/workflows/dev-packages.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# Action to publish packages under the `next` tag for testing -# Packages are versioned as `0.0.0-{tag}-DATETIMESTAMP` -name: Packages Deploy - -on: workflow_dispatch - -jobs: - publish: - name: Publish Dev Packages - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Setup NodeJS - uses: actions/setup-node@v2 - with: - node-version: 20 - - - name: Setup PNPM - run: | - npm install -g pnpm - echo "PNPM version: $(pnpm -v)" - echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc - - - name: Install Dependencies - run: pnpm install --frozen-lockfile - - - name: Build - run: pnpm build:packages - - - name: Publish - run: | - pnpm changeset version --no-git-tag --snapshot dev - pnpm changeset publish --tag dev diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de80a9f..e5bdd42 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: branches: - main + workflow_dispatch: concurrency: ${{ github.workflow }}-${{ github.ref }} @@ -11,6 +12,10 @@ 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 @@ -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 diff --git a/package.json b/package.json index afca11b..cf5c10a 100644 --- a/package.json +++ b/package.json @@ -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": [],