From 513de9c73137fd6c34ff9b350838998744d7d1ee Mon Sep 17 00:00:00 2001 From: Luis Bocanegra Date: Sun, 8 Sep 2024 02:28:51 -0600 Subject: [PATCH] ci: automate releases and changelog with googleapis/release-please-action --- .github/workflows/release-please.yml | 41 ++++++++++++++++++++++++++++ .release-please-manifest.json | 3 ++ release-please-config.json | 16 +++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..025db03 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,41 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: lukka/get-cmake@latest + + - uses: googleapis/release-please-action@v4 + id: release + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + + - name: Generate plasmoid package + if: ${{ steps.release.outputs.release_created }} + run: | + sudo apt-get install -y extra-cmake-modules + ./package-plasmoid.sh + + - name: Extract project name + if: ${{ steps.release.outputs.release_created }} + run: | + PROJECT_NAME=$(grep -Po '(?<=project\().*(?=\))' CMakeLists.txt) + echo "PROJECT_NAME=$PROJECT_NAME" >> $GITHUB_ENV + + - name: Upload plasmoid package to release + if: ${{ steps.release.outputs.release_created }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload ${{ steps.release.outputs.tag_name }} ./${{ env.PROJECT_NAME }}-${{steps.release.outputs.tag_name}}.plasmoid diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..9d47a3d --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.2.2" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..726e700 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,16 @@ +{ + "packages": { + ".": { + "changelog-path": "CHANGELOG.md", + "release-type": "simple", + "extra-files": [ + { + "type": "json", + "path": "package/metadata.json", + "jsonpath": "$.KPlugin.Version" + } + ] + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +}