From 4139d18ec1aa28bb9ae92d555ef7f1720aa54ed6 Mon Sep 17 00:00:00 2001 From: You-Sheng Yang Date: Thu, 4 Apr 2024 23:18:27 +0800 Subject: [PATCH] ci: enable release-please Signed-off-by: You-Sheng Yang --- .../.release-please-manifest.json | 3 ++ .../release-please/release-please-config.json | 49 +++++++++++++++++++ .github/workflows/release.yml | 39 +++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .github/release-please/.release-please-manifest.json create mode 100644 .github/release-please/release-please-config.json create mode 100644 .github/workflows/release.yml diff --git a/.github/release-please/.release-please-manifest.json b/.github/release-please/.release-please-manifest.json new file mode 100644 index 000000000..e18ee0776 --- /dev/null +++ b/.github/release-please/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.0" +} diff --git a/.github/release-please/release-please-config.json b/.github/release-please/release-please-config.json new file mode 100644 index 000000000..1d1c9b114 --- /dev/null +++ b/.github/release-please/release-please-config.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "changelog-sections": [ + { + "section": "🚀 Features", + "type": "feat" + }, + { + "section": "🐛 Bugfixes", + "type": "fix" + }, + { + "section": "⬆️ Dependency updates", + "type": "deps" + }, + { + "section": "🧰 Maintenance", + "type": "build" + }, + { + "section": "🧰 Maintenance", + "type": "chore" + }, + { + "section": "🧰 Testing", + "type": "ci" + }, + { + "section": "🧰 Testing", + "type": "tests" + }, + { + "section": "🧰 Maintenance", + "type": "packaging" + }, + { + "section": "🧰 Documentation", + "type": "docs" + } + ], + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "include-component-in-tag": false, + "release-type": "simple", + "extra-files": ["README.md"] + } + } +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..b11af4cfd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v4 + id: rp + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + config-file: .github/release-please/release-please-config.json + manifest-file: .github/release-please/.release-please-manifest.json + + - uses: actions/checkout@v4 + if: ${{ steps.rp.outputs.release_created }} + + - name: Update major/minor tags + if: ${{ steps.rp.outputs.release_created }} + run: | + git config user.name "github-actions[bot]" + git config user.email "159864+github-actions.bot@users.noreply.github.com" + + full_tag="${{ steps.rp.outputs.tag_name }}" + major_minor_tag="${full_tag%.*}" + major_tag="${major_minor_tag%.*}" + git tag -d "${major_tag}" "${major_minor_tag}" || true + + git tag -a "${major_tag}" -m "Release ${major_tag}" + git tag -a "${major_minor_tag}" -m "Release ${major_minor_tag}" + git push -f origin "${major_tag}" "${major_minor_tag}"