Replaces `scripts/gpgkms` with [`github.com/coder/gpgkms`](https://github.com/coder/gpgkms) v0.2.0, the same code extracted into a shared module (terraform-provider-coder already signs its releases with it). v0.2.0 also rejects keys that aren't HSM-backed (`gpg-release` is `HSM`, and the check reads `protectionLevel` from the existing `GetPublicKey` call, so no new IAM is needed), limits each KMS request to a minute, and writes `-out` atomically. - `go.mod`: gpgkms is a `tool` dependency, so the version is pinned in `go.mod`/`go.sum` and Dependabot keeps it current. This bumps go-crypto 1.4.1 → 1.5.2, google.golang.org/api 0.308.0 → 0.311.0 and circl 1.6.3 → 1.6.5, plus a few indirect dependencies. go-crypto is now only indirect: nothing else in coder/coder imports it. - `scripts/gpgkms.sh` (new): runs it with `go tool` (like `scripts/format_go_file.sh` does for gofumpt and gci), passing the release key's OpenPGP identity (name, email, creation time, 4-year lifetime). The library takes these as flags instead of hardcoding them, so they now live in one place. - It also pins `-fingerprint 0F685EFE0AE5A8182A473DD86E3A8E5613707520`, so signing and `public-key` fail if the KMS key or creation time ever change. That's the fingerprint every current main build prints (e.g. run 44031030839), and I recomputed it from the KMS public key and the creation time alone, without signing anything. The fingerprint doesn't cover the user ID or lifetime; the equivalence check below does. - `scripts/sign_with_gpg.sh` and the "Print GPG KMS public key" step in `build.yaml` call the wrapper instead of `./scripts/gpgkms`. Signatures stay armored `.v2.asc` files, as before. - `scripts/gpgkms/` is deleted. ## Same key, same signatures The OpenPGP key's fingerprint depends on these exact inputs, so I checked that nothing changed. With a local RSA-4096 key standing in for KMS, the deleted `newEntity`/`writePublicKey`/`sign` produce the same output as the gpgkms CLI with the flags read out of `scripts/gpgkms.sh`: - The public key is **byte for byte identical**. - A signature with `-prepend` is armored the same way and has the same length (only the timestamp differs). Both the prepended signature and the KMS signature verify in both outputs. - Changing the lifetime in the wrapper by one hour makes the comparison fail, so the check is sensitive. ``` $ git -C gpgkms describe --tags v0.2.0 $ WRAPPER_ARGS_FILE=wrapper-args.txt go test ./cmd/gpgkms -run TestCoderWrapperMatchesOldCoderCode -count=3 -v === RUN TestCoderWrapperMatchesOldCoderCode equiv_coder_test.go:40: wrapper args: ["-name" "Coder Release Signing Key" "-email" "security@coder.com" "-created" "2026-11-16T00:00:00Z" "-lifetime" "35040h"] --- PASS: TestCoderWrapperMatchesOldCoderCode (0.33s) --- PASS: TestCoderWrapperMatchesOldCoderCode (0.11s) --- PASS: TestCoderWrapperMatchesOldCoderCode (0.20s) ok github.com/coder/gpgkms/cmd/gpgkms 0.634s # with -lifetime 35041h equiv_coder_test.go:56: public keys differ: FAIL # with the wrapper's -fingerprint pin and a random test key derived key has fingerprint 9794B34B5E098DE61DD6CE247E0DFD4BF203C917, want 0F685EFE0AE5A8182A473DD86E3A8E5613707520 (wrong -key, -created or KMS key?) ``` (The byte-for-byte comparison runs without `-fingerprint`, since the test key is random.) gpgkms also has its own compatibility test against this identity (`compat_test.go`). Other checks: ``` $ ./scripts/gpgkms.sh public-key # from the repo root (build.yaml) gpgkms: -key is required $ cd scripts && ./gpgkms.sh public-key # from scripts/ (build_go.sh -> execrelative) gpgkms: -key is required $ ./gpgkms.sh sign -key x -prepend ../no-such-file -out o.asc ../go.mod # relative paths resolve from the caller gpgkms: read prepend signature: open ../no-such-file: no such file or directory $ shellcheck -x scripts/gpgkms.sh scripts/sign_with_gpg.sh # clean $ shfmt -d scripts/gpgkms.sh scripts/sign_with_gpg.sh # clean $ actionlint .github/workflows/build.yaml # clean $ go build ./... && go mod tidy -diff # clean ``` Not run here: real signing through Cloud KMS. The first main build after merging prints the public key in the job summary; it should be identical to the one printed by current main builds. --- AI disclosure: this PR was written by an AI coding agent (Xum) at my direction, and the agent ran the verification above. It stays a draft until I've reviewed it.
428 lines
17 KiB
YAML
428 lines
17 KiB
YAML
name: build
|
|
|
|
# Builds, signs and publishes ghcr.io/coder/coder-preview for every commit to
|
|
# main and release/*. dogfood.cdr.dev pulls new main builds itself through Flux
|
|
# image automation in coder/dogfood, so this workflow needs no cluster access.
|
|
#
|
|
# The build job signs exactly like release.yaml, through the same
|
|
# ./.github/actions/build-coder action. This workflow has no pull_request or
|
|
# workflow_dispatch trigger: the release-signer identity provider only accepts
|
|
# this file on a push to main or release/X.Y, or the creation of a release/X.Y
|
|
# branch, from the ci-signing environment.
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release/*
|
|
# Same as the docs filter in ci.yaml's changes job: commits that only
|
|
# touch these don't need a signed build.
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- ".claude/docs/**"
|
|
- "*.md"
|
|
- "examples/web-server/**"
|
|
- "examples/monitoring/**"
|
|
- "examples/lima/**"
|
|
|
|
# GitHub Actions does not reliably trigger push-based runs when a new branch
|
|
# is created at a commit that already has a run (e.g. from main). The create
|
|
# event fires separately so newly cut release branches get an image. Other
|
|
# branch and tag creations are filtered out by the build job condition.
|
|
create:
|
|
|
|
permissions: {}
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')
|
|
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-22.04' }}
|
|
# Gates access to the signing secrets and identities. Both GCP signing
|
|
# service accounts only trust this environment and `release`.
|
|
environment: ci-signing
|
|
permissions:
|
|
contents: read
|
|
# Necessary to push docker images to ghcr.io.
|
|
packages: write
|
|
# Necessary for GCP authentication (https://github.com/google-github-actions/setup-gcloud#usage)
|
|
# Also necessary for keyless cosign (https://docs.sigstore.dev/cosign/signing/overview/)
|
|
# And for GitHub Actions attestation
|
|
id-token: write
|
|
# Required for GitHub Actions attestation
|
|
attestations: write
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: GHCR Login
|
|
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# The fat binaries embed every slim binary, so this builds and signs all
|
|
# of them (darwin, Windows and GPG), as release.yaml does. Notarization
|
|
# only applies to darwin archives, which main builds don't produce.
|
|
- name: Build and sign
|
|
id: build
|
|
uses: ./.github/actions/build-coder
|
|
with:
|
|
sign: "true"
|
|
extra-tools: "cosign syft"
|
|
# Enable React profiling build and discoverable source maps for the
|
|
# dogfood deployment (dogfood.cdr.dev). This also applies to
|
|
# release/* branch builds, but those still produce coder-preview
|
|
# images, not release images. Release images are built by
|
|
# release.yaml (no profiling).
|
|
react-profiling: "true"
|
|
targets: >-
|
|
build/coder_@VERSION@_linux_amd64
|
|
build/coder_@VERSION@_linux_arm64
|
|
build/coder_@VERSION@_linux_armv7
|
|
build/coder_@VERSION@_windows_amd64.zip
|
|
build/coder_@VERSION@_linux_amd64.tar.gz
|
|
build/coder_@VERSION@_linux_arm64.tar.gz
|
|
build/coder_@VERSION@_linux_armv7.tar.gz
|
|
build/coder_@VERSION@_linux_amd64.deb
|
|
build/coder_@VERSION@_linux_arm64.deb
|
|
build/coder_@VERSION@_linux_armv7.deb
|
|
ev-workload-identity-provider: ${{ vars.GCP_CODE_SIGNING_WORKLOAD_ID_PROVIDER }}
|
|
ev-service-account: ${{ vars.GCP_CODE_SIGNING_SERVICE_ACCOUNT }}
|
|
ev-key: ${{ secrets.EV_KEY }}
|
|
ev-keystore: ${{ secrets.EV_KEYSTORE }}
|
|
ev-tsa-url: ${{ secrets.EV_TSA_URL }}
|
|
ev-signing-cert: ${{ secrets.EV_SIGNING_CERT }}
|
|
release-signer-workload-identity-provider: ${{ secrets.GPG_KMS_WORKLOAD_ID_PROVIDER }}
|
|
release-signer-service-account: ${{ secrets.GPG_KMS_SERVICE_ACCOUNT }}
|
|
gpg-release-key: ${{ secrets.GPG_RELEASE_KEY_BASE64 }}
|
|
gpg-kms-key: ${{ secrets.GPG_KMS_KEY }}
|
|
ac-certificate-pem: ${{ secrets.AC_CERTIFICATE_PEM }}
|
|
ac-kms-key-ring: ${{ secrets.AC_KMS_KEY_RING }}
|
|
ac-kms-key: ${{ secrets.AC_KMS_KEY }}
|
|
|
|
# The KMS key's OpenPGP form can only be made by CI. Publish it from main
|
|
# builds so its fingerprint can be checked and added to release.key.
|
|
- name: Print GPG KMS public key
|
|
if: github.ref == 'refs/heads/main'
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ -z "$GPG_KMS_KEY" ]]; then
|
|
echo "GPG_KMS_KEY is not set, skipping."
|
|
exit 0
|
|
fi
|
|
./scripts/gpgkms.sh public-key -key "$GPG_KMS_KEY" > "$RUNNER_TEMP/gpg-kms-public.key"
|
|
gpg --show-keys --with-fingerprint "$RUNNER_TEMP/gpg-kms-public.key"
|
|
{
|
|
echo "### Cloud KMS release signing key"
|
|
echo '```'
|
|
gpg --show-keys --with-fingerprint "$RUNNER_TEMP/gpg-kms-public.key"
|
|
cat "$RUNNER_TEMP/gpg-kms-public.key"
|
|
echo '```'
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
env:
|
|
GPG_KMS_KEY: ${{ secrets.GPG_KMS_KEY }}
|
|
GOOGLE_APPLICATION_CREDENTIALS: ${{ steps.build.outputs.release-signer-credentials-file }}
|
|
|
|
# Free up disk space before building Docker images. The preceding
|
|
# Build step produces ~2 GB of binaries and packages, the Go build
|
|
# cache is ~1.3 GB, and node_modules is ~500 MB. Docker image
|
|
# builds, pushes, and SBOM generation need headroom that isn't
|
|
# available without reclaiming some of that space.
|
|
- name: Clean up build cache
|
|
run: |
|
|
set -euxo pipefail
|
|
# Go caches are no longer needed; binaries are already compiled.
|
|
go clean -cache -modcache
|
|
# Remove .apk and .rpm packages that are not uploaded as
|
|
# artifacts and were only built as make prerequisites.
|
|
rm -f ./build/*.apk ./build/*.rpm
|
|
|
|
- name: Build Linux Docker images
|
|
id: build-docker
|
|
env:
|
|
CODER_IMAGE_BASE: ghcr.io/coder/coder-preview
|
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
|
# Skip building .deb/.rpm/.apk/.tar.gz as prerequisites for
|
|
# the Docker image targets; they were already built above.
|
|
DOCKER_IMAGE_NO_PREREQUISITES: "true"
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
# build Docker images for each architecture
|
|
version="$(./scripts/version.sh)"
|
|
tag="${version//+/-}"
|
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
|
|
|
# build images for each architecture
|
|
# note: omitting the -j argument to avoid race conditions when pushing
|
|
make build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
|
|
|
|
# only push if we are on main branch or release branch
|
|
if [[ "${GITHUB_REF}" == "refs/heads/main" || "${GITHUB_REF}" == refs/heads/release/* ]]; then
|
|
# build and push multi-arch manifest, this depends on the other images
|
|
# being pushed so will automatically push them
|
|
# note: omitting the -j argument to avoid race conditions when pushing
|
|
make push/build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
|
|
|
|
# Define specific tags
|
|
tags=("$tag")
|
|
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
|
|
# main-<commit unix time>-<sha> sorts by commit time, so the
|
|
# dogfood Flux ImagePolicy can select the newest main build.
|
|
tags+=("main" "latest" "main-$(git log -1 --format=%ct HEAD)-$(git rev-parse --short=12 HEAD)")
|
|
elif [[ "${GITHUB_REF}" == refs/heads/release/* ]]; then
|
|
tags+=("release-${GITHUB_REF#refs/heads/release/}")
|
|
fi
|
|
|
|
# Create and push a multi-arch manifest for each tag
|
|
# we are adding `latest` tag and keeping `main` for backward
|
|
# compatibality
|
|
for t in "${tags[@]}"; do
|
|
echo "Pushing multi-arch manifest for tag: $t"
|
|
# shellcheck disable=SC2046
|
|
./scripts/build_docker_multiarch.sh \
|
|
--push \
|
|
--target "ghcr.io/coder/coder-preview:$t" \
|
|
--version "$version" \
|
|
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
|
|
done
|
|
fi
|
|
|
|
- name: SBOM Generation and Attestation
|
|
if: github.ref == 'refs/heads/main'
|
|
continue-on-error: true
|
|
env:
|
|
COSIGN_EXPERIMENTAL: 1
|
|
BUILD_TAG: ${{ steps.build-docker.outputs.tag }}
|
|
run: |
|
|
set -euxo pipefail
|
|
|
|
# Define image base and tags
|
|
IMAGE_BASE="ghcr.io/coder/coder-preview"
|
|
TAGS=("${BUILD_TAG}" "main" "latest")
|
|
|
|
# Generate and attest SBOM for each tag
|
|
for tag in "${TAGS[@]}"; do
|
|
IMAGE="${IMAGE_BASE}:${tag}"
|
|
SBOM_FILE="coder_sbom_${tag//[:\/]/_}.spdx.json"
|
|
|
|
echo "Generating SBOM for image: ${IMAGE}"
|
|
syft "${IMAGE}" -o spdx-json > "${SBOM_FILE}"
|
|
|
|
echo "Attesting SBOM to image: ${IMAGE}"
|
|
cosign clean --force=true "${IMAGE}"
|
|
cosign attest --type spdxjson \
|
|
--predicate "${SBOM_FILE}" \
|
|
--yes \
|
|
"${IMAGE}"
|
|
done
|
|
|
|
- name: Resolve Docker image digests for attestation
|
|
id: docker_digests
|
|
if: github.ref == 'refs/heads/main'
|
|
continue-on-error: true
|
|
env:
|
|
IMAGE_BASE: ghcr.io/coder/coder-preview
|
|
BUILD_TAG: ${{ steps.build-docker.outputs.tag }}
|
|
run: |
|
|
set -euxo pipefail
|
|
main_digest=$(docker buildx imagetools inspect --raw "${IMAGE_BASE}:main" | sha256sum | awk '{print "sha256:"$1}')
|
|
echo "main_digest=${main_digest}" >> "$GITHUB_OUTPUT"
|
|
latest_digest=$(docker buildx imagetools inspect --raw "${IMAGE_BASE}:latest" | sha256sum | awk '{print "sha256:"$1}')
|
|
echo "latest_digest=${latest_digest}" >> "$GITHUB_OUTPUT"
|
|
version_digest=$(docker buildx imagetools inspect --raw "${IMAGE_BASE}:${BUILD_TAG}" | sha256sum | awk '{print "sha256:"$1}')
|
|
echo "version_digest=${version_digest}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: GitHub Attestation for Docker image
|
|
id: attest_main
|
|
if: github.ref == 'refs/heads/main' && steps.docker_digests.outputs.main_digest != ''
|
|
continue-on-error: true
|
|
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
|
|
with:
|
|
subject-name: ghcr.io/coder/coder-preview
|
|
subject-digest: ${{ steps.docker_digests.outputs.main_digest }}
|
|
push-to-registry: true
|
|
|
|
- name: GitHub Attestation for Docker image (latest tag)
|
|
id: attest_latest
|
|
if: github.ref == 'refs/heads/main' && steps.docker_digests.outputs.latest_digest != ''
|
|
continue-on-error: true
|
|
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
|
|
with:
|
|
subject-name: ghcr.io/coder/coder-preview
|
|
subject-digest: ${{ steps.docker_digests.outputs.latest_digest }}
|
|
push-to-registry: true
|
|
|
|
- name: GitHub Attestation for version-specific Docker image
|
|
id: attest_version
|
|
if: github.ref == 'refs/heads/main' && steps.docker_digests.outputs.version_digest != ''
|
|
continue-on-error: true
|
|
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
|
|
with:
|
|
subject-name: ghcr.io/coder/coder-preview
|
|
subject-digest: ${{ steps.docker_digests.outputs.version_digest }}
|
|
push-to-registry: true
|
|
|
|
# Report attestation failures but don't fail the workflow
|
|
- name: Check attestation status
|
|
if: github.ref == 'refs/heads/main'
|
|
run: | # zizmor: ignore[template-injection] We're just reading steps.attest_x.outcome here, no risk of injection
|
|
if [[ "${{ steps.attest_main.outcome }}" == "failure" ]]; then
|
|
echo "::warning::GitHub attestation for main tag failed"
|
|
fi
|
|
if [[ "${{ steps.attest_latest.outcome }}" == "failure" ]]; then
|
|
echo "::warning::GitHub attestation for latest tag failed"
|
|
fi
|
|
if [[ "${{ steps.attest_version.outcome }}" == "failure" ]]; then
|
|
echo "::warning::GitHub attestation for version-specific tag failed"
|
|
fi
|
|
|
|
- name: GitHub Attestation for binaries
|
|
id: attest_binaries
|
|
if: github.ref == 'refs/heads/main'
|
|
continue-on-error: true
|
|
uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2
|
|
with:
|
|
subject-path: |
|
|
./build/*.tar.gz
|
|
./build/*.zip
|
|
./build/*.deb
|
|
|
|
- name: Report binary attestation failure
|
|
if: github.ref == 'refs/heads/main' && steps.attest_binaries.outcome == 'failure'
|
|
run: echo "::warning::GitHub attestation for binaries failed"
|
|
|
|
- name: Upload build artifact (coder-linux-amd64.tar.gz)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: coder-linux-amd64.tar.gz
|
|
path: ./build/*_linux_amd64.tar.gz
|
|
retention-days: 7
|
|
|
|
- name: Upload build artifact (coder-linux-amd64.deb)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: coder-linux-amd64.deb
|
|
path: ./build/*_linux_amd64.deb
|
|
retention-days: 7
|
|
|
|
- name: Upload build artifact (coder-linux-arm64.tar.gz)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: coder-linux-arm64.tar.gz
|
|
path: ./build/*_linux_arm64.tar.gz
|
|
retention-days: 7
|
|
|
|
- name: Upload build artifact (coder-linux-arm64.deb)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: coder-linux-arm64.deb
|
|
path: ./build/*_linux_arm64.deb
|
|
retention-days: 7
|
|
|
|
- name: Upload build artifact (coder-linux-armv7.tar.gz)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: coder-linux-armv7.tar.gz
|
|
path: ./build/*_linux_armv7.tar.gz
|
|
retention-days: 7
|
|
|
|
- name: Upload build artifact (coder-linux-armv7.deb)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: coder-linux-armv7.deb
|
|
path: ./build/*_linux_armv7.deb
|
|
retention-days: 7
|
|
|
|
- name: Upload build artifact (coder-windows-amd64.zip)
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: coder-windows-amd64.zip
|
|
path: ./build/*_windows_amd64.zip
|
|
retention-days: 7
|
|
|
|
|
|
# Runs separately from the signing job so this third-party action never runs
|
|
# in the same job as the signing credentials.
|
|
prune:
|
|
needs: build
|
|
if: github.ref == 'refs/heads/main'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Prune old images
|
|
uses: vlaurin/action-ghcr-prune@0cf7d39f88546edd31965acba78cdcb0be14d641 # v0.6.0
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
organization: coder
|
|
container: coder-preview
|
|
keep-younger-than: 30 # days
|
|
keep-tags: latest
|
|
keep-tags-regexes: ^pr
|
|
prune-tags-regexes: |
|
|
^main-
|
|
^v
|
|
prune-untagged: true
|
|
|
|
notify-slack-on-failure:
|
|
needs:
|
|
- build
|
|
- prune
|
|
runs-on: ubuntu-latest
|
|
environment: main
|
|
if: failure() && github.ref == 'refs/heads/main'
|
|
steps:
|
|
- name: Send Slack notification
|
|
run: |
|
|
curl -X POST -H 'Content-type: application/json' \
|
|
--data '{
|
|
"blocks": [
|
|
{
|
|
"type": "header",
|
|
"text": {
|
|
"type": "plain_text",
|
|
"text": "❌ Build failure in main",
|
|
"emoji": true
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "*View failure:* <'"${RUN_URL}"'|Click here>"
|
|
}
|
|
}
|
|
]
|
|
}' "${SLACK_WEBHOOK}"
|
|
env:
|
|
SLACK_WEBHOOK: ${{ secrets.CI_FAILURE_SLACK_WEBHOOK }}
|
|
RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|