From 49660089834e85c24869025c1760378be0a00900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Riedm=C3=BCller?= Date: Mon, 9 Sep 2024 12:57:30 +0200 Subject: [PATCH] ci: setup and configure release please --- .github/workflows/init-npm/action.yml | 21 +++++++++++ .github/workflows/release-please.yml | 54 +++++++++++++++++++++++++++ .github/workflows/release-ui.yml | 37 ------------------ .release-please-manifest.json | 1 + release-please-config.json | 11 ++++++ 5 files changed, 87 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/init-npm/action.yml create mode 100644 .github/workflows/release-please.yml delete mode 100644 .github/workflows/release-ui.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/init-npm/action.yml b/.github/workflows/init-npm/action.yml new file mode 100644 index 0000000..a165985 --- /dev/null +++ b/.github/workflows/init-npm/action.yml @@ -0,0 +1,21 @@ +name: Init pnpm + +runs: + using: "composite" + steps: + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + run_install: false + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: pnpm + registry-url: https://registry.npmjs.org + + - name: Install dependencies + run: pnpm install --frozen-lockfile + shell: bash diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..ea4a693 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,54 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + utils--release_created: ${{ steps.release.outputs['packages/utils--release_created']}} + ui--release_created: ${{ steps.release.outputs['packages/ui--release_created']}} + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + + publish-utils: + if: ${{needs.release-please.outputs.utils--release_created}} + runs-on: ubuntu-latest + needs: release-please + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: ./.github/workflows/init-pnpm + + - name: Publish 🚀 + shell: bash + run: pnpm publish packages/utils --access public --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + publish-ui: + if: ${{needs.release-please.outputs.ui--release_created}} + runs-on: ubuntu-latest + needs: release-please + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: ./.github/workflows/init-pnpm + + - name: Publish 🚀 + shell: bash + run: pnpm publish packages/ui --access public --no-git-checks + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-ui.yml b/.github/workflows/release-ui.yml deleted file mode 100644 index e7afb36..0000000 --- a/.github/workflows/release-ui.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Release ui package - -on: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: 9 - run_install: false - - - name: Install Node.js - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: pnpm - registry-url: https://registry.npmjs.org - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build all packages - run: pnpm -r build - - - name: Publish 🚀 - shell: bash - run: pnpm publish packages/ui --access public --no-git-checks - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1 @@ +{} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..86d2e41 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,11 @@ +{ + "monorepo-tags": true, + "packages": { + "packages/utils": { + "release-type": "node" + }, + "packages/ui": { + "release-type": "node" + } + } +}