From 9eb0c8d64628c5a50aa4c91d122229d79e45d484 Mon Sep 17 00:00:00 2001 From: lotyp Date: Sat, 15 Jul 2023 19:30:55 +0300 Subject: [PATCH] feat: add create-release action using changesets --- .../workflows/create-changesets-release.yml | 61 +++++++++++++++++++ .pre-commit-config.yaml | 4 +- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/create-changesets-release.yml diff --git a/.github/workflows/create-changesets-release.yml b/.github/workflows/create-changesets-release.yml new file mode 100644 index 0000000..750db85 --- /dev/null +++ b/.github/workflows/create-changesets-release.yml @@ -0,0 +1,61 @@ +name: Create release or publish to pnpm reusable workflow +on: + workflow_call: + inputs: + os: + description: The operating system to run the workflow on + required: false + type: string + default: ubuntu-latest + node: + description: The node version to use when creating the release + required: false + type: string + default: 18 + repository: + description: The repository to use when creating the release + required: true + type: string + secrets: + github_token: + required: true + npm_token: + required: true + +jobs: + release: + if: ${{ github.repository == inputs.repository && contains('refs/heads/master', github.ref)}} + runs-on: ${{ inputs.os }} + + steps: + - name: 📦 Check out the codebase + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: ⚙️ Setup node ${{ inputs.node }} + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.node }} + registry-url: 'https://registry.npmjs.org/' + + - name: 📥 Monorepo install + uses: wayofdev/gh-actions/actions/pnpm-install@master + with: + enable-corepack: false + cache-node-modules: true + + - name: 🦋 Create release pull request or publish to npm + id: changesets + uses: changesets/action@v1 + with: + commit: 'chore: update versions' + title: 'chore: update versions' + cwd: ${{ github.workspace }} + publish: pnpm run cs:publish + version: pnpm run cs:version + setupGitUser: true + env: + HOME: ${{ github.workspace }} + GITHUB_TOKEN: ${{ secrets.github_token }} + NPM_TOKEN: ${{ secrets.npm_token }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 486d12c..3696b79 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,14 +10,14 @@ repos: - id: fix-encoding-pragma - repo: https://github.com/commitizen-tools/commitizen - rev: 3.2.2 + rev: 3.5.3 hooks: - id: commitizen stages: - commit-msg - repo: https://github.com/mpalmer/action-validator - rev: v0.5.1 + rev: v0.5.3 hooks: - id: action-validator stages: