diff --git a/.github/workflows/lint-pr-title.yml b/.github/workflows/lint-pr-title.yml new file mode 100644 index 0000000..02339a7 --- /dev/null +++ b/.github/workflows/lint-pr-title.yml @@ -0,0 +1,16 @@ +name: Lint PR Title + +on: + pull_request_target: + types: [opened, edited, synchronize] + +permissions: + pull-requests: read + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..9dbbf76 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,65 @@ +name: Release Please + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +defaults: + run: + shell: bash + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + steps: + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3 + with: + app-id: ${{ vars.SDK_BOT_APP_ID }} + private-key: ${{ secrets.SDK_BOT_PRIVATE_KEY }} + + - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5 + id: release + with: + token: ${{ steps.generate-token.outputs.token }} + + publish: + needs: release-please + if: ${{ needs.release-please.outputs.release_created == 'true' }} + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 + with: + version: 10 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + with: + node-version: 24 + registry-url: 'https://registry.npmjs.org' + cache: 'pnpm' + + - name: Install Dependencies + run: pnpm install + + - name: Build project + run: pnpm run build + + - name: Publish + run: | + VERSION=$(node -p "require('./package.json').version") + if [[ "$VERSION" == *"-"* ]]; then + pnpm publish --tag next --access=public --provenance --no-git-checks + else + pnpm publish --tag latest --access=public --provenance --no-git-checks + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3cf287d..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Release - -on: - # Support manually pushing a new release - workflow_dispatch: {} - # Trigger when a release is published - release: - types: [published] - -defaults: - run: - shell: bash - -jobs: - test: - name: Publish to NPM - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 - with: - version: 10 - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: 24 - registry-url: 'https://registry.npmjs.org' - cache: 'pnpm' - - - name: Install Dependencies - run: | - pnpm install - - - name: Build project - run: | - pnpm run build - - - name: Push Release - if: ${{ !github.event.release.prerelease }} - run: | - pnpm publish --tag latest --access=public --no-git-checks --provenance - - - name: Push Pre-Release - if: ${{ github.event.release.prerelease }} - run: | - pnpm publish --tag next --access=public --no-git-checks --provenance diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..210d290 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.5.1" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..ea29abf --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "include-component-in-tag": false, + "packages": { + ".": { + "release-type": "node", + "changelog-path": "CHANGELOG.md", + "versioning": "default", + "bump-minor-pre-major": true + } + } +}