From cb567bb83aa30bb1bfbdb0e664917f99b1df8ede Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Tue, 25 Nov 2025 17:27:52 +0000 Subject: [PATCH] chore(ci): Add release-plz for releasing --- .github/workflows/release-plz.yml | 94 +++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/release-plz.yml diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 00000000..80a17c85 --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,94 @@ +name: Release-plz + +permissions: {} + +on: + push: + branches: + - main + +jobs: + release-plz-release: + name: Release-plz release + environment: release + runs-on: ubuntu-latest + if: github.repository_owner == 'openstack-experimental' + permissions: + contents: read + id-token: write # Required for trusted publishing + + steps: + - name: Harden Runner + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Install Rust toolchain + run: rustup update stable + + # Generating a GitHub token, so that PRs and tags created by + # the release-plz-action can trigger actions workflows. + - name: Generate GitHub token + uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0 + id: generate-token + with: + app-id: ${{ secrets.RELEASE_PLZ_APP_ID }} # <-- GitHub App ID secret name + private-key: ${{ secrets.RELEASE_PLZ_PRIVATE_KEY }} # <-- GitHub App private key secret name + # pull-requests permission is not needed for the `release` command, so restricting it to contents only + permission-contents: write + + - name: Run release-plz + uses: release-plz/action@d529f731ae3e89610ada96eda34e5c6ba3b12214 # v0.5.118 + with: + command: release + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + + release-plz-pr: + name: Release-plz PR + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'openstack-experimental' }} + permissions: + contents: read + concurrency: + group: release-plz-${{ github.ref }} + cancel-in-progress: false + + steps: + - name: Harden Runner + uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Install Rust toolchain + run: rustup update stable + + # Generating a GitHub token, so that PRs and tags created by + # the release-plz-action can trigger actions workflows. + - name: Generate GitHub token + uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0 + id: generate-token + with: + app-id: ${{ secrets.RELEASE_PLZ_APP_ID }} + private-key: ${{ secrets.RELEASE_PLZ_APP_ID }} + permission-contents: write + permission-pull-requests: write + + - name: Run release-plz + uses: release-plz/action@d529f731ae3e89610ada96eda34e5c6ba3b12214 # v0.5.118 + with: + command: release-pr + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}