From 86f583bc69b96df226f67cd15a7a0e8a5330ae0f Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Mon, 9 Feb 2026 10:25:38 +0000 Subject: [PATCH 1/2] Add action workflow linting and publish :main image --- .github/workflows/ci.yaml | 81 ++++++++++++++++++++++++++++++++++++++- flake.nix | 2 + 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 69257c30..d9921f70 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,6 +2,9 @@ name: CI on: pull_request: + push: + branches: + - main permissions: contents: read @@ -11,10 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false - name: Setup Go - uses: actions/setup-go@v5 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: go-version-file: go.mod cache: true @@ -34,3 +39,75 @@ jobs: env: GOFLAGS: -mod=vendor run: go build ./... + + lint-actions: + name: Lint GitHub Actions + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + + - name: Setup Go + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + with: + go-version-file: go.mod + cache: true + + - name: Run actionlint + run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.10 + + - name: Run zizmor + uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0 + with: + advanced-security: false + inputs: .github/workflows/ci.yaml + + publish-main: + name: Publish GHCR :main + needs: [test, lint-actions] + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + persist-credentials: false + + - name: Setup Go + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + with: + go-version-file: go.mod + cache: false + + - name: Build linux/amd64 binary for image + env: + GOFLAGS: -mod=vendor + CGO_ENABLED: "0" + GOOS: linux + GOARCH: amd64 + run: go build -o coder-k8s ./ + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push :main + uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5.4.0 + with: + context: . + file: Dockerfile.goreleaser + push: true + tags: ghcr.io/coder/coder-k8s:main diff --git a/flake.nix b/flake.nix index b03287a8..15c0ca5d 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,8 @@ gnumake git goreleaser + actionlint + zizmor ]; }; } From e5e9446cea8bc607002b71dcbf83c39d279a32b7 Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Mon, 9 Feb 2026 10:34:07 +0000 Subject: [PATCH 2/2] Lint all workflows with zizmor and harden release workflow --- .github/workflows/ci.yaml | 2 +- .github/workflows/release.yaml | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d9921f70..35ba66e0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,7 +64,7 @@ jobs: uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0 with: advanced-security: false - inputs: .github/workflows/ci.yaml + inputs: .github/workflows publish-main: name: Publish GHCR :main diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c396f08d..6a0f3f84 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,28 +13,29 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 with: fetch-depth: 0 + persist-credentials: false - name: Setup Go - uses: actions/setup-go@v5 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 with: go-version-file: go.mod - cache: true + cache: false - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 + uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 with: distribution: goreleaser version: latest