diff --git a/.github/files/release-please/.release-please-manifest.json b/.github/files/release-please/.release-please-manifest.json new file mode 100644 index 00000000..466df71c --- /dev/null +++ b/.github/files/release-please/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0" +} diff --git a/.github/files/release-please/release-please-config.json b/.github/files/release-please/release-please-config.json new file mode 100644 index 00000000..43225531 --- /dev/null +++ b/.github/files/release-please/release-please-config.json @@ -0,0 +1,77 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "changelog-sections": [ + { + "type": "feat", + "section": "Features", + "hidden": false + }, + { + "type": "fix", + "section": "Bug Fixes", + "hidden": false + }, + { + "type": "perf", + "section": "Performance Improvements", + "hidden": false + }, + { + "type": "deps", + "section": "Dependencies", + "hidden": false + }, + { + "type": "revert", + "section": "Reverts", + "hidden": false + }, + { + "type": "docs", + "section": "Documentation", + "hidden": true + }, + { + "type": "style", + "section": "Styles", + "hidden": true + }, + { + "type": "chore", + "section": "Miscellaneous Chores", + "hidden": true + }, + { + "type": "refactor", + "section": "Code Refactoring", + "hidden": true + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System", + "hidden": true + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "release-type": "node", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "draft": false, + "prerelease": false, + "include-component-in-tag": false, + "pull-request-title-pattern": "release: v${version}" + } + } +} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..95764672 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,45 @@ +on: + push: + branches: main + +name: release-please + +jobs: + release-please: + if: github.repository_owner == '4m-mazi' + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release-please.outputs.release_created }} + steps: + - uses: google-github-actions/release-please-action@cc61a07e2da466bebbc19b3a7dd01d6aecb20d1e # v4.0.2 + id: release-please + with: + config-file: .github/files/release-please/release-please-config.json + manifest-file: .github/files/release-please/.release-please-manifest.json + skip-github-pull-request: ${{ startsWith(github.event.head_commit.message, 'release:') && github.event.head_commit.author.name == 'github-actions[bot]' }} + + label-published: + needs: [release-please] + if: ${{ needs.release-please.outputs.release_created }} + permissions: + pull-requests: write + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + runs-on: ubuntu-latest + steps: + - name: Create published label + run: | + gh label create 'autorelease: published' --color=EDEDED || true + - name: Get PR number + id: pr-number + run: | + echo "pr_number=$(printf '${{ github.event.head_commit.message }}' | head -n1 | sed -nE 's/.+\(#([0-9]+)\)$/\1/p')" >> "$GITHUB_OUTPUT" + - name: Change labels on PR + run: | + gh pr edit ${{ steps.pr-number.outputs.pr_number }} \ + --remove-label='autorelease: tagged' \ + --add-label='autorelease: published'