From 24e3be8ca7a4c03f135de5d8790e2779e1c8aa34 Mon Sep 17 00:00:00 2001 From: Julian Koehn Date: Wed, 18 Nov 2026 10:47:57 +0100 Subject: [PATCH 1/2] feat: mint Kopexa Operator tokens instead of personal access tokens Add the github/app-token composite action, which mints a short-lived installation token of the Kopexa Operator GitHub App. nextjs-delivery uses it for Release Please, so release PRs trigger required checks. nextjs-image uses it for the envs dispatch, scoped to Actions write on kopexa-grc/envs. Both fall back to RELEASE_PLEASE_TOKEN and GITOPS_TOKEN while callers do not pass KOPEXA_OPERATOR_PRIVATE_KEY. --- .github/workflows/nextjs-delivery.yml | 23 ++++++- .github/workflows/nextjs-image.yml | 18 +++++- README.md | 1 + docs/nextjs.md | 11 +++- docs/workflows/nextjs-delivery.md | 2 +- docs/workflows/nextjs-image.md | 2 +- github/app-token/README.md | 76 +++++++++++++++++++++++ github/app-token/action.yml | 86 +++++++++++++++++++++++++++ 8 files changed, 213 insertions(+), 6 deletions(-) create mode 100644 github/app-token/README.md create mode 100644 github/app-token/action.yml diff --git a/.github/workflows/nextjs-delivery.yml b/.github/workflows/nextjs-delivery.yml index 42a92f1..13615d1 100644 --- a/.github/workflows/nextjs-delivery.yml +++ b/.github/workflows/nextjs-delivery.yml @@ -31,9 +31,14 @@ on: default: .release-please-manifest.json type: string secrets: + KOPEXA_OPERATOR_PRIVATE_KEY: + description: Private key of the Kopexa Operator app; preferred over the legacy tokens below + required: false RELEASE_PLEASE_TOKEN: + description: Deprecated; use KOPEXA_OPERATOR_PRIVATE_KEY required: false GITOPS_TOKEN: + description: Deprecated; use KOPEXA_OPERATOR_PRIVATE_KEY required: false permissions: contents: write @@ -48,11 +53,25 @@ jobs: created: ${{ steps.release.outputs.release_created }} tag: ${{ steps.release.outputs.tag_name }} staging: ${{ steps.gate.outputs.staging }} + env: + # Only a boolean, so the key itself never lands in the job environment. + USE_KOPEXA_OPERATOR: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY != '' && vars.KOPEXA_OPERATOR_CLIENT_ID != '' }} steps: + # Release PRs opened with GITHUB_TOKEN start no PR workflows, so they would + # carry no required checks. A Kopexa Operator token does start them. + - id: operator + if: env.USE_KOPEXA_OPERATOR == 'true' + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ vars.KOPEXA_OPERATOR_CLIENT_ID }} + private-key: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY }} + permission-contents: write + permission-pull-requests: write + permission-issues: write - id: release uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 with: - token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }} + token: ${{ steps.operator.outputs.token || secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }} config-file: ${{ inputs.release-config }} manifest-file: ${{ inputs.release-manifest }} - name: Exclude merged release PRs from staging (including reruns) @@ -81,6 +100,7 @@ jobs: image-tag: staging-${{ github.sha }} application: ${{ inputs.application }} secrets: + KOPEXA_OPERATOR_PRIVATE_KEY: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY }} GITOPS_TOKEN: ${{ secrets.GITOPS_TOKEN }} production: needs: release @@ -95,4 +115,5 @@ jobs: image-tag: ${{ needs.release.outputs.tag }} application: ${{ inputs.application }} secrets: + KOPEXA_OPERATOR_PRIVATE_KEY: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY }} GITOPS_TOKEN: ${{ secrets.GITOPS_TOKEN }} diff --git a/.github/workflows/nextjs-image.yml b/.github/workflows/nextjs-image.yml index e3d4871..a3a8b64 100644 --- a/.github/workflows/nextjs-image.yml +++ b/.github/workflows/nextjs-image.yml @@ -40,7 +40,11 @@ on: default: linux/amd64 type: string secrets: + KOPEXA_OPERATOR_PRIVATE_KEY: + description: Private key of the Kopexa Operator app; preferred over GITOPS_TOKEN + required: false GITOPS_TOKEN: + description: Deprecated; use KOPEXA_OPERATOR_PRIVATE_KEY required: false outputs: digest: @@ -166,7 +170,19 @@ jobs: url: ${{ vars.DEPLOYMENT_URL }} permissions: contents: read + env: + # Only a boolean, so the key itself never lands in the job environment. + USE_KOPEXA_OPERATOR: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY != '' && vars.KOPEXA_OPERATOR_CLIENT_ID != '' }} steps: + - id: operator + if: vars.GITOPS_ENABLED == 'true' && env.USE_KOPEXA_OPERATOR == 'true' + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ vars.KOPEXA_OPERATOR_CLIENT_ID }} + private-key: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY }} + owner: kopexa-grc + repositories: envs + permission-actions: write - name: Dispatch website deployment and await result if: vars.GITOPS_ENABLED == 'true' uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 @@ -177,7 +193,7 @@ jobs: SOURCE_REF: ${{ inputs.source-ref }} SOURCE_SHA: ${{ needs.image.outputs.source-sha }} with: - github-token: ${{ secrets.GITOPS_TOKEN }} + github-token: ${{ steps.operator.outputs.token || secrets.GITOPS_TOKEN }} script: | const sourceSha = process.env.SOURCE_SHA; const target = {owner: 'kopexa-grc', repo: 'envs'}; diff --git a/README.md b/README.md index dd8288c..7e8e8ee 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Call them with `steps[].uses`; your workflow owns the runner and job permissions - [Go build](go/build/README.md) - [Go unit tests](go/unit-test/README.md) - [PR auto-approval](github/auto-approve/README.md) +- [Kopexa Operator app token](github/app-token/README.md): short-lived bot token instead of personal access tokens ## Reusable workflows: complete jobs diff --git a/docs/nextjs.md b/docs/nextjs.md index 16cd3b9..b8a2673 100644 --- a/docs/nextjs.md +++ b/docs/nextjs.md @@ -47,12 +47,19 @@ configuration copied from the actual current deployment. Do not guess production Secrets: -- `GITOPS_TOKEN`: GitHub App installation token or fine-grained token scoped to +- `KOPEXA_OPERATOR_PRIVATE_KEY` (organization secret) plus `KOPEXA_OPERATOR_CLIENT_ID` + (organization variable): preferred. Both workflows mint short-lived tokens of + the Kopexa Operator GitHub App, one for Release Please (Contents, Issues, Pull + requests write on the calling repo, so release PRs trigger required checks) + and one for the envs dispatch (Actions write on `kopexa-grc/envs`). Pass the + secret explicitly or with `secrets: inherit`. When it is set, the two tokens + below are ignored. See [Kopexa Operator app token](../github/app-token/README.md). +- `GITOPS_TOKEN` (deprecated, fallback): GitHub App installation token or fine-grained token scoped to `kopexa-grc/envs` with Actions read/write. Used only to dispatch and observe `websites.yml`; the sender no longer checks out or writes envs. Store as an environment secret. The receiver separately needs `WEBSITE_SOURCE_TOKEN` with source Contents/Actions read and uses its own GITHUB_TOKEN for envs commits. -- `RELEASE_PLEASE_TOKEN`: optional repository secret with Contents, Issues and Pull +- `RELEASE_PLEASE_TOKEN` (deprecated, fallback): optional repository secret with Contents, Issues and Pull requests write. Needed if generated Release Please PRs must trigger required CI checks. GITHUB_TOKEN fallback works for release creation and the in-workflow production job, but its generated PRs/releases do not trigger other workflows. diff --git a/docs/workflows/nextjs-delivery.md b/docs/workflows/nextjs-delivery.md index b93f1d4..8ad6644 100644 --- a/docs/workflows/nextjs-delivery.md +++ b/docs/workflows/nextjs-delivery.md @@ -6,7 +6,7 @@ Ordinary commits build staging; merging a release PR builds production only. Required inputs: `dockerfile`, `image`. Optional `application` defaults to the caller repository name. Legacy staging/production paths are accepted but ignored. Optional: `next-cache-target`, `release-config`, `release-manifest`. -Optional secrets: `RELEASE_PLEASE_TOKEN`, `GITOPS_TOKEN`. +Optional secrets: `KOPEXA_OPERATOR_PRIVATE_KEY` (preferred, with variable `KOPEXA_OPERATOR_CLIENT_ID`); legacy fallbacks `RELEASE_PLEASE_TOKEN`, `GITOPS_TOKEN`. Requires write permissions for contents, pull requests, issues and packages. Calls the image workflow at the same revision. The caller owns the `staging` and diff --git a/docs/workflows/nextjs-image.md b/docs/workflows/nextjs-image.md index 777d1c5..3b9a585 100644 --- a/docs/workflows/nextjs-image.md +++ b/docs/workflows/nextjs-image.md @@ -7,6 +7,6 @@ The sender no longer checks out envs or commits manifests. Required inputs: environment, source-ref, dockerfile, image, image-tag. Optional: application, next-cache-target, health-path, platforms. Legacy gitops-path and image-alias remain accepted but are ignored. Returns the published digest. -Requires Contents read and Packages write; GITOPS_TOKEN needs envs Actions read/write. +Requires Contents read and Packages write; the envs dispatch uses a Kopexa Operator token (`KOPEXA_OPERATOR_PRIVATE_KEY` + `KOPEXA_OPERATOR_CLIENT_ID`), falling back to GITOPS_TOKEN with envs Actions read/write. See [configuration and event contract](../nextjs.md). diff --git a/github/app-token/README.md b/github/app-token/README.md new file mode 100644 index 0000000..90f71c8 --- /dev/null +++ b/github/app-token/README.md @@ -0,0 +1,76 @@ +# Kopexa Operator app token + +Mints a short-lived installation token of **Kopexa Operator**, the Kopexa CI GitHub App. +Use it wherever a workflow needs more than `GITHUB_TOKEN` can do, instead of a +personal access token: + +- Pull requests opened with it (for example by Release Please) trigger the + repository's PR workflows. PRs opened with `GITHUB_TOKEN` do not. +- Cross-repository calls, for example the workflow dispatch to `envs`. + +The token is valid for one hour, limited to the repositories and permissions you +request, and revoked when the job ends. It is not tied to a person. + +## Configuration + +| Name | Kind | Scope | +| ---- | ---- | ----- | +| `KOPEXA_OPERATOR_CLIENT_ID` | Variable | Organization kopexa-grc, selected repositories | +| `KOPEXA_OPERATOR_PRIVATE_KEY` | Secret | Organization kopexa-grc, selected repositories | + +The app itself needs these repository permissions: Actions, Contents, Issues and +Pull requests read and write, Metadata read. Request only what a job needs. + +## Inputs + +| Name | Description | Required | +| ---- | ----------- | -------- | +| client-id | Kopexa Operator client ID | Yes | +| private-key | Kopexa Operator private key | Yes | +| owner | Owner of the target repositories, defaults to the calling owner | No | +| repositories | Repository names, defaults to the calling repository | No | +| permission-contents | `read`, `write` or empty to omit | No | +| permission-pull-requests | `read`, `write` or empty to omit | No | +| permission-issues | `read`, `write` or empty to omit | No | +| permission-actions | `read`, `write` or empty to omit | No | + +Leaving every permission empty grants all permissions of the installation. + +## Outputs + +| Name | Description | +| ---- | ----------- | +| token | Installation token | +| app-slug | `kopexaoperator` | +| git-user-name | `kopexaoperator[bot]` | +| git-user-email | Noreply address for bot commits | + +## Example: Release Please + +```yaml +steps: + - id: operator + uses: kopexa-grc/github-actions/github/app-token@ # vX.Y.Z + with: + client-id: ${{ vars.KOPEXA_OPERATOR_CLIENT_ID }} + private-key: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY }} + permission-contents: write + permission-pull-requests: write + permission-issues: write + - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + with: + token: ${{ steps.operator.outputs.token }} +``` + +## Example: dispatch a workflow in another repository + +```yaml +steps: + - id: operator + uses: kopexa-grc/github-actions/github/app-token@ # vX.Y.Z + with: + client-id: ${{ vars.KOPEXA_OPERATOR_CLIENT_ID }} + private-key: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY }} + repositories: envs + permission-actions: write +``` diff --git a/github/app-token/action.yml b/github/app-token/action.yml new file mode 100644 index 0000000..6294161 --- /dev/null +++ b/github/app-token/action.yml @@ -0,0 +1,86 @@ +# Copyright (c) Kopexa GmbH +# SPDX-License-Identifier: BUSL-1.1 + +--- +name: Kopexa Operator app token +description: + Mint a short-lived installation token of the Kopexa Operator GitHub App instead of + using a personal access token +author: Kopexa +inputs: + client-id: + description: Kopexa Operator client ID, usually vars.KOPEXA_OPERATOR_CLIENT_ID + required: true + private-key: + description: Kopexa Operator private key, usually secrets.KOPEXA_OPERATOR_PRIVATE_KEY + required: true + owner: + description: Owner of the target repositories + default: ${{ github.repository_owner }} + required: false + repositories: + description: | + Comma or newline separated repository names the token may access. + Defaults to the calling repository only. + default: ${{ github.event.repository.name }} + required: false + permission-contents: + description: Contents permission (read, write or empty to omit) + default: '' + required: false + permission-pull-requests: + description: Pull requests permission (read, write or empty to omit) + default: '' + required: false + permission-issues: + description: Issues permission (read, write or empty to omit) + default: '' + required: false + permission-actions: + description: Actions permission (read, write or empty to omit) + default: '' + required: false +outputs: + token: + description: Installation token, valid for one hour and revoked after the job + value: ${{ steps.token.outputs.token }} + app-slug: + description: App slug, for example kopexaoperator + value: ${{ steps.token.outputs.app-slug }} + git-user-name: + description: Commit author name of the bot, for example kopexaoperator[bot] + value: ${{ steps.identity.outputs.name }} + git-user-email: + description: Commit author email of the bot (noreply address) + value: ${{ steps.identity.outputs.email }} + +runs: + using: composite + steps: + - name: Mint installation token + id: token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ inputs.client-id }} + private-key: ${{ inputs.private-key }} + owner: ${{ inputs.owner }} + repositories: ${{ inputs.repositories }} + permission-contents: ${{ inputs.permission-contents }} + permission-pull-requests: ${{ inputs.permission-pull-requests }} + permission-issues: ${{ inputs.permission-issues }} + permission-actions: ${{ inputs.permission-actions }} + + - name: Resolve bot git identity + id: identity + shell: bash + env: + GH_TOKEN: ${{ steps.token.outputs.token }} + APP_SLUG: ${{ steps.token.outputs.app-slug }} + run: | + set -euo pipefail + name="${APP_SLUG}[bot]" + id="$(gh api "/users/${name}" --jq .id)" + { + echo "name=${name}" + echo "email=${id}+${name}@users.noreply.github.com" + } >> "$GITHUB_OUTPUT" From dcf246c4b0b76093002a61b19f4cfd26762a86cf Mon Sep 17 00:00:00 2001 From: Julian Koehn Date: Wed, 18 Nov 2026 10:50:23 +0100 Subject: [PATCH 2/2] feat: add release-please action with Kopexa Operator token Drop-in replacement for the googleapis/release-please-action step. It mints a Kopexa Operator token when client-id and private-key are given and falls back to GITHUB_TOKEN otherwise. All upstream outputs are passed through, per-path monorepo outputs via outputs-json. This repository's own release workflow uses it, which replaces the manual workflow-lint dispatch for release PRs. --- .github/workflows/release-please.yml | 36 +++------ README.md | 1 + docs/releases.md | 8 +- github/release-please/README.md | 57 ++++++++++++++ github/release-please/action.yml | 111 +++++++++++++++++++++++++++ 5 files changed, 183 insertions(+), 30 deletions(-) create mode 100644 github/release-please/README.md create mode 100644 github/release-please/action.yml diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 979800d..d6df96c 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -4,10 +4,7 @@ on: branches: [main] workflow_dispatch: permissions: - contents: write - pull-requests: write - issues: write - actions: write + contents: read concurrency: group: release-please cancel-in-progress: false @@ -17,27 +14,14 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - id: release - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + # Checkout only to run this repository's own action from ./github. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - config-file: .release-please-config.json - manifest-file: .release-please-manifest.json - # GITHUB_TOKEN-created PRs do not trigger pull_request workflows. - # Explicit dispatch runs the same required validation on the release head. - - name: Validate the release PR - if: steps.release.outputs.prs_created == 'true' - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 - env: - RELEASE_PRS: ${{ steps.release.outputs.prs }} + persist-credentials: false + # The Kopexa Operator token opens the release PR, so its pull_request + # workflows (actionlint) start on their own. No dispatch workaround needed. + - id: release + uses: ./github/release-please with: - script: | - for (const pr of JSON.parse(process.env.RELEASE_PRS || '[]')) { - const { data } = await github.rest.pulls.get({ ...context.repo, pull_number: pr.number }); - if (data.head.repo.full_name !== `${context.repo.owner}/${context.repo.repo}` || - !data.head.ref.startsWith('release-please--')) { - throw new Error('Unexpected release PR source'); - } - await github.rest.actions.createWorkflowDispatch({ - ...context.repo, workflow_id: 'workflow-lint.yml', ref: data.head.ref - }); - } + client-id: ${{ vars.KOPEXA_OPERATOR_CLIENT_ID }} + private-key: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY }} diff --git a/README.md b/README.md index 7e8e8ee..fd97c61 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Call them with `steps[].uses`; your workflow owns the runner and job permissions - [Go unit tests](go/unit-test/README.md) - [PR auto-approval](github/auto-approve/README.md) - [Kopexa Operator app token](github/app-token/README.md): short-lived bot token instead of personal access tokens +- [Release Please](github/release-please/README.md): Release Please with a Kopexa Operator token, drop-in for the upstream step ## Reusable workflows: complete jobs diff --git a/docs/releases.md b/docs/releases.md index 6903444..1df72c5 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -12,10 +12,10 @@ use full `vX.Y.Z` tags without a component prefix. No moving major tag is create 5. Update consumers explicitly to the release SHA, optionally with the version as a comment, or to its full version tag. Existing SHA-pinned consumers do not move. -The workflow uses `GITHUB_TOKEN`; no new credential is needed. Because bot-created -PRs do not trigger PR workflows, it explicitly dispatches Workflow validation on -the release branch. That provides the required `actionlint` check without bypassing -branch protection. Release PRs are not automatically approved or merged. +The workflow runs this repository's own `github/release-please` action with a +Kopexa Operator token (`KOPEXA_OPERATOR_CLIENT_ID`, `KOPEXA_OPERATOR_PRIVATE_KEY`). +Release PRs opened with it trigger the required `actionlint` check like any other +PR. Release PRs are not automatically approved or merged. The dependency upgrade uses Node.js 24 actions. Self-hosted runners must support that runtime (at least v2.327.1; authenticated Git inside Docker with checkout v7 diff --git a/github/release-please/README.md b/github/release-please/README.md new file mode 100644 index 0000000..9c1840e --- /dev/null +++ b/github/release-please/README.md @@ -0,0 +1,57 @@ +# Release Please with Kopexa Operator + +Runs [Release Please](https://github.com/googleapis/release-please-action) with a +short-lived token of the Kopexa Operator GitHub App. Release PRs opened with it +trigger the repository's PR workflows, so they carry the required checks. PRs +opened with `GITHUB_TOKEN` do not. + +Use it as a drop-in replacement for the `googleapis/release-please-action` step. +Steps after it in the same job keep working with the same outputs. + +Without `client-id` and `private-key` the action falls back to `github-token` +(default: `GITHUB_TOKEN`), so it also works where the app is not configured. + +## Inputs + +| Name | Description | Default | +| ---- | ----------- | ------- | +| client-id | `vars.KOPEXA_OPERATOR_CLIENT_ID` | empty | +| private-key | `secrets.KOPEXA_OPERATOR_PRIVATE_KEY` | empty | +| github-token | Fallback token | `github.token` | +| config-file | Release Please config, ignored with release-type | `.release-please-config.json` | +| manifest-file | Release Please manifest, ignored with release-type | `.release-please-manifest.json` | +| release-type | Single-package mode, for example `node`, `go`, `simple` | empty | +| target-branch | Branch to release from | default branch | + +## Outputs + +The usual Release Please outputs: `release_created`, `releases_created`, +`tag_name`, `version`, `major`, `minor`, `patch`, `sha`, `upload_url`, +`prs_created`, `pr`, `prs`, `paths_released`. + +Monorepo outputs per path are in `outputs-json`: + +```yaml +${{ fromJSON(steps.release.outputs.outputs-json)['apps/web--tag_name'] }} +``` + +## Example + +```yaml +permissions: + contents: read +jobs: + release: + runs-on: ubuntu-latest + steps: + - id: release + uses: kopexa-grc/github-actions/github/release-please@ # vX.Y.Z + with: + client-id: ${{ vars.KOPEXA_OPERATOR_CLIENT_ID }} + private-key: ${{ secrets.KOPEXA_OPERATOR_PRIVATE_KEY }} + - if: steps.release.outputs.release_created == 'true' + run: echo "Released ${{ steps.release.outputs.tag_name }}" +``` + +With the app token the job itself needs no write permissions. Only the +`GITHUB_TOKEN` fallback needs `contents`, `pull-requests` and `issues: write`. diff --git a/github/release-please/action.yml b/github/release-please/action.yml new file mode 100644 index 0000000..a480d4c --- /dev/null +++ b/github/release-please/action.yml @@ -0,0 +1,111 @@ +# Copyright (c) Kopexa GmbH +# SPDX-License-Identifier: BUSL-1.1 + +--- +name: Release Please with Kopexa Operator +description: + Run Release Please with a short-lived Kopexa Operator token, so release PRs + trigger the repository's required checks +author: Kopexa +inputs: + client-id: + description: Kopexa Operator client ID, usually vars.KOPEXA_OPERATOR_CLIENT_ID + default: '' + required: false + private-key: + description: | + Kopexa Operator private key, usually secrets.KOPEXA_OPERATOR_PRIVATE_KEY. + Without client-id and private-key, github-token is used instead. + default: '' + required: false + github-token: + description: Fallback token when no Kopexa Operator credentials are given + default: ${{ github.token }} + required: false + config-file: + description: Release Please config; ignored when release-type is set + default: .release-please-config.json + required: false + manifest-file: + description: Release Please manifest; ignored when release-type is set + default: .release-please-manifest.json + required: false + release-type: + description: Single-package mode without config files (for example node, go, simple) + default: '' + required: false + target-branch: + description: Branch to release from; defaults to the repository default branch + default: '' + required: false +outputs: + release_created: + description: "'true' when a release was created for the root package" + value: ${{ steps.release.outputs.release_created }} + releases_created: + description: "'true' when any release was created" + value: ${{ steps.release.outputs.releases_created }} + tag_name: + description: Tag of the root package release + value: ${{ steps.release.outputs.tag_name }} + version: + description: Version of the root package release, without the leading v + value: ${{ steps.release.outputs.version }} + major: + description: Major version of the root package release + value: ${{ steps.release.outputs.major }} + minor: + description: Minor version of the root package release + value: ${{ steps.release.outputs.minor }} + patch: + description: Patch version of the root package release + value: ${{ steps.release.outputs.patch }} + sha: + description: Commit the root package release was tagged on + value: ${{ steps.release.outputs.sha }} + upload_url: + description: Upload URL of the root package release + value: ${{ steps.release.outputs.upload_url }} + prs_created: + description: "'true' when a release PR was opened or updated" + value: ${{ steps.release.outputs.prs_created }} + pr: + description: JSON of the first release PR + value: ${{ steps.release.outputs.pr }} + prs: + description: JSON array of all release PRs + value: ${{ steps.release.outputs.prs }} + paths_released: + description: JSON array of released package paths (monorepos) + value: ${{ steps.release.outputs.paths_released }} + outputs-json: + description: | + All Release Please outputs as JSON, including per-path keys such as + "apps/web--tag_name". Read them with fromJSON(...)['apps/web--tag_name']. + value: ${{ toJSON(steps.release.outputs) }} + +runs: + using: composite + steps: + - name: Mint Kopexa Operator token + id: operator + if: inputs.client-id != '' && inputs.private-key != '' + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ inputs.client-id }} + private-key: ${{ inputs.private-key }} + permission-contents: write + permission-pull-requests: write + permission-issues: write + + # release-please-action reads config-file/manifest-file only while + # release-type is unset, so exactly one of the two modes is passed. + - name: Release Please + id: release + uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + with: + token: ${{ steps.operator.outputs.token || inputs.github-token }} + release-type: ${{ inputs.release-type }} + config-file: ${{ inputs.release-type == '' && inputs.config-file || '' }} + manifest-file: ${{ inputs.release-type == '' && inputs.manifest-file || '' }} + target-branch: ${{ inputs.target-branch }}