Files
zitadel/.github/workflows/ci.yml
Elio Bischof 42979053da chore: fix lint test build on main (#10866)
# Which Problems Are Solved

In order for golangci-lint to be able to compare what changed against
main, we have to check out main on branches.
If the pipeline runs on main, the branch can't be checked out twice and
the pipeline fails.

# How the Problems Are Solved

The step `Fetch main branch` in `lint_test_build` is only executed if
the workflow doesn't run on main, because in this case, the branch is
already checked out by the `Checkout Repository` step.

# Additional Changes

PRs can only be merged if `lint_test_buld` succeeds on an up-to-date
branch. When a PR is merged, it triggers a push event which runs
`lint_test_build` again on main with the same conditions. This is
obsolete. Pushes to main don't trigger the `lint_test_build` workflow
anymore.

# Additional Context

- Resolves
https://github.com/zitadel/zitadel/actions/runs/18339015014/job/52229685065

(cherry picked from commit 593ae09fa9)
2025-10-16 08:06:22 +02:00

71 lines
2.1 KiB
YAML

name: CI
on:
push:
tags-ignore:
- "*"
branches:
- "main"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: write
packages: write
issues: write
pull-requests: write
jobs:
lint_test_build:
uses: ./.github/workflows/lint_test_build.yml
if: ${{ github.ref != 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
with:
node_version: "22"
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
NX_CLOUD_ACCESS_TOKEN_READONLY: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
pack:
uses: ./.github/workflows/pack.yml
permissions:
contents: write
packages: write
secrets:
GCR_JSON_KEY_BASE64: ${{ secrets.GCR_JSON_KEY_BASE64 }}
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
node_version: "22"
semantic_version: "23.0.7"
image_name_github_api: "ghcr.io/zitadel/zitadel"
image_name_google_api: "europe-docker.pkg.dev/zitadel-common/zitadel-repo/zitadel"
image_name_github_login: "ghcr.io/zitadel/zitadel-login"
image_name_google_login: "europe-docker.pkg.dev/zitadel-common/zitadel-repo/zitadel-login"
release:
uses: ./.github/workflows/release.yml
permissions:
packages: write
contents: write
issues: write
pull-requests: write
needs:
- lint_test_build
- pack
if: ${{ github.event_name == 'workflow_dispatch' }}
secrets:
GCR_JSON_KEY_BASE64: ${{ secrets.GCR_JSON_KEY_BASE64 }}
APP_ID: ${{ secrets.APP_ID }}
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
with:
semantic_version: "23.0.7"
image_name_github_api: "ghcr.io/zitadel/zitadel"
image_name_google_api: "europe-docker.pkg.dev/zitadel-common/zitadel-repo/zitadel"
image_name_github_login: "ghcr.io/zitadel/zitadel-login"
image_name_google_login: "europe-docker.pkg.dev/zitadel-common/zitadel-repo/zitadel-login"