Skip to content

deps: update module github.com/tidwall/gjson to v1.17.3 #4026

deps: update module github.com/tidwall/gjson to v1.17.3

deps: update module github.com/tidwall/gjson to v1.17.3 #4026

Workflow file for this run

name: CI
on:
push:
branches:
- main
- release
pull_request:
branches:
- main
- release
env:
GO_VERSION: "1.22.5"
GOLANGCI_LINT_VERSION: "v1.57.2"
HELM_VERSION: "3.14.1"
KUBECONFORM_VERSION: "0.6.4"
KUBERNETES_API_VERSION: "1.27.0"
NODE_VERSION: "18.16"
COSIGN_VERSION: "v2.2.3"
CYCLONEDX_GOMOD_VERSION: "v1.4.1"
DOCUMENTATION_URL: "https://dadrus.github.io/heimdall/"
permissions: read-all
jobs:
check-changes:
runs-on: ubuntu-22.04
outputs:
code_changed: ${{steps.code-changes.outputs.count > 0}}
test_data_changed: ${{steps.test-data-changes.outputs.count > 0}}
image_config_changed: ${{steps.image-config-changes.outputs.count > 0}}
helm_chart_changed: ${{steps.helm-chart-changes.outputs.count > 0}}
docs_changed: ${{steps.docs-changes.outputs.count > 0}}
ci_config_changed: ${{steps.ci-changes.outputs.count > 0}}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Check code changes
id: code-changes
uses: technote-space/get-diff-action@f27caffdd0fb9b13f4fc191c016bb4e0632844af # v6.1.2
with:
PATTERNS: |
*.go
**/*.go
schema/*.json
FILES: |
go.mod
go.sum
- name: Check test data changes
id: test-data-changes
uses: technote-space/get-diff-action@f27caffdd0fb9b13f4fc191c016bb4e0632844af # v6.1.2
with:
PATTERNS: |
cmd/**/*.yaml
internal/**/*.yaml
- name: Check container image config changes
id: image-config-changes
uses: technote-space/get-diff-action@f27caffdd0fb9b13f4fc191c016bb4e0632844af # v6.1.2
with:
PATTERNS: |
docker/Dockerfile
- name: Check helm chart changes
id: helm-chart-changes
uses: technote-space/get-diff-action@f27caffdd0fb9b13f4fc191c016bb4e0632844af # v6.1.2
with:
PATTERNS: |
charts/**
- name: Check documentation changes
id: docs-changes
uses: technote-space/get-diff-action@f27caffdd0fb9b13f4fc191c016bb4e0632844af # v6.1.2
with:
PATTERNS: |
docs/**
- name: Check CI settings changes
id: ci-changes
uses: technote-space/get-diff-action@f27caffdd0fb9b13f4fc191c016bb4e0632844af # v6.1.2
with:
PATTERNS: |
.github/workflows/*.yaml
check-licenses:
runs-on: ubuntu-22.04
needs:
- check-changes
if: >
needs.check-changes.outputs.code_changed == 'true' ||
needs.check-changes.outputs.ci_config_changed == 'true'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "${{ env.GO_VERSION }}"
- name: Get google/go-licenses package
run: go install github.com/google/go-licenses@v1.6.0
- name: Check the licenses
run: go-licenses check --disallowed_types=forbidden,restricted,reciprocal,permissive,unknown .
lint-code:
runs-on: ubuntu-22.04
needs:
- check-changes
if: >
needs.check-changes.outputs.code_changed == 'true' ||
needs.check-changes.outputs.ci_config_changed == 'true'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: Review code
uses: reviewdog/action-golangci-lint@7708105983c614f7a2725e2172908b7709d1c3e4 # v2.6.2
with:
go_version: "${{ env.GO_VERSION }}"
golangci_lint_version: "${{ env.GOLANGCI_LINT_VERSION }}"
reporter: github-pr-review
fail_on_error: true
lint-api:
runs-on: ubuntu-22.04
needs:
- check-changes
if: >
needs.check-changes.outputs.docs_changed == 'true' ||
needs.check-changes.outputs.ci_config_changed == 'true'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Redocly CLI
run: npm i -g @redocly/cli@1.10.5
- name: Run Redocly Lint
run: redocly lint
lint-dockerfiles:
runs-on: ubuntu-22.04
needs:
- check-changes
if: >
needs.check-changes.outputs.image_config_changed == 'true' ||
needs.check-changes.outputs.ci_config_changed == 'true'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Run hadolint
uses: reviewdog/action-hadolint@2d90b15b2b969e507fc2a31af6e29ca19a0f9516 # v1.45.0
with:
reporter: github-pr-review
fail_on_error: true
lint-helm-chart:
runs-on: ubuntu-22.04
needs:
- check-changes
if: >
needs.check-changes.outputs.helm_chart_changed == 'true' ||
needs.check-changes.outputs.ci_config_changed == 'true'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Setup k8s tools
uses: yokawasa/action-setup-kube-tools@5fe385031665158529decddddb51d6224422836e # v0.11.1
with:
setup-tools: |
helm
kubeconform
helm: '${{ env.HELM_VERSION }}'
kubeconform: '${{ env.KUBECONFORM_VERSION }}'
- name: Helm Lint
run: helm lint ./charts/heimdall
- name: Kubeconform decision mode deployment
run: |
helm template --set demo.enabled=true ./charts/heimdall > decision-demo.yaml
kubeconform --skip RuleSet -kubernetes-version ${{ env.KUBERNETES_API_VERSION }} decision-demo.yaml
- name: Kubeconform proxy mode deployment
run: |
helm template --set operationMode=proxy --set demo.enabled=true ./charts/heimdall > proxy-demo.yaml
kubeconform --skip RuleSet -kubernetes-version ${{ env.KUBERNETES_API_VERSION }} decision-demo.yaml
test:
runs-on: ubuntu-22.04
needs:
- check-changes
if: >
needs.check-changes.outputs.code_changed == 'true' ||
needs.check-changes.outputs.test_data_changed == 'true' ||
needs.check-changes.outputs.ci_config_changed == 'true'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "${{ env.GO_VERSION }}"
- name: Test
run: go test -v -coverprofile=coverage.cov -coverpkg=./... ./...
- name: Code Coverage
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: coverage.cov
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
prepare-release:
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release'
permissions:
pull-requests: write
contents: write
outputs:
release_created: ${{ steps.release_prepare.outputs.release_created }}
tag_name: ${{ steps.release_prepare.outputs.tag_name }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Prepare Release
id: release_prepare
uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3
with:
target-branch: ${{ github.ref_name }}
build-binaries:
runs-on: ubuntu-22.04
needs:
- test
- prepare-release
if: always() && needs.prepare-release.outputs.release_created == false && needs.test.result == 'success'
strategy:
matrix:
# build and publish in parallel: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64
goos: [ linux, windows, darwin ]
goarch: [ amd64, arm64, arm ]
exclude:
- goarch: arm
goos: darwin
- goarch: arm
goos: windows
- goarch: arm64
goos: windows
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "${{ env.GO_VERSION }}"
- name: Build
run: CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -trimpath -ldflags="-buildid= -w -s -X github.com/dadrus/heimdall/version.Version=${{ github.sha }}" -o ./build/
- uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
if: github.ref == 'refs/heads/main'
with:
name: build-result-${{ matrix.goos }}-${{ matrix.goarch }}
path: ./build/*
retention-days: 30
release-binaries:
runs-on: ubuntu-22.04
needs:
- prepare-release
if: needs.prepare-release.outputs.release_created
permissions:
contents: write
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "${{ env.GO_VERSION }}"
- name: Install Cosign
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
with:
cosign-release: "${{ env.COSIGN_VERSION }}"
- name: Install CycloneDX gomod
run: go install github.com/CycloneDX/cyclonedx-gomod/cmd/cyclonedx-gomod@v1.4.1
- name: Generate SBOM
uses: CycloneDX/gh-gomod-generate-sbom@efc74245d6802c8cefd925620515442756c70d8f # v2.0.0
with:
version: "${{ env.CYCLONEDX_GOMOD_VERSION }}"
args: app -licenses -assert-licenses -json -std -output CycloneDX-SBOM.json -main .
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# this job builds container images for PRs, as well as publishes these on merges to main
build-dev-container-images:
runs-on: ubuntu-22.04
permissions:
packages: write
id-token: write
needs:
- test
- check-changes
- prepare-release
if: >
github.ref == 'refs/heads/main' &&
needs.prepare-release.outputs.release_created == false &&
(needs.test.result == 'success' || (needs.test.result == 'skipped' && needs.check-changes.outputs.image_config_changed == 'true'))
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Install Cosign
if: github.ref == 'refs/heads/main'
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
with:
cosign-release: "${{ env.COSIGN_VERSION }}"
- name: Set up Go # required as the sbom generator is compiled using go < 1.21
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "${{ env.GO_VERSION }}"
- name: Generate SBOM
if: github.ref == 'refs/heads/main'
uses: CycloneDX/gh-gomod-generate-sbom@efc74245d6802c8cefd925620515442756c70d8f # v2.0.0
with:
version: "${{ env.CYCLONEDX_GOMOD_VERSION }}"
args: app -licenses -assert-licenses -json -std -output CycloneDX-SBOM.json -main .
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Collect container meta-info
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ github.repository }}
labels: |
org.opencontainers.image.version=${{ github.sha }}
org.opencontainers.image.documentation=${{ env.DOCUMENTATION_URL }}
- name: Build images
if: github.ref != 'refs/heads/main'
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm
push: false
build-args: VERSION=${{ github.sha }}
tags: ${{ github.repository }}:local
- name: Login to DockerHub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push dev images to container registry
if: github.ref == 'refs/heads/main'
id: publish-image
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm
push: true
build-args: VERSION=${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ github.repository }}:dev
${{ github.repository }}:dev-${{ github.sha }}
ghcr.io/${{ github.repository }}:dev
ghcr.io/${{ github.repository }}:dev-${{ github.sha }}
# DockerHub
- name: Sign the image published in DockerHub
if: steps.publish-image.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_REPOSITORY: ${{ github.repository }}-signatures
run: cosign sign --yes ${{ github.repository }}@${{ steps.publish-image.outputs.digest }}
- name: Attest and attach SBOM to the image published in DockerHub
if: steps.publish-image.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_REPOSITORY: ${{ github.repository }}-sbom
run: cosign attest --yes --predicate CycloneDX-SBOM.json --type cyclonedx ${{ github.repository }}@${{ steps.publish-image.outputs.digest }}
# GHCR
- name: Sign the image published in GitHub
if: steps.publish-image.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_REPOSITORY: ghcr.io/${{ github.repository }}-signatures
run: cosign sign --yes ghcr.io/${{ github.repository }}@${{ steps.publish-image.outputs.digest }}
- name: Attest and attach SBOM to the image published in GitHub
if: steps.publish-image.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_REPOSITORY: ghcr.io/${{ github.repository }}-sbom
run: cosign attest --yes --predicate CycloneDX-SBOM.json --type cyclonedx ghcr.io/${{ github.repository }}@${{ steps.publish-image.outputs.digest }}
# this job releases container images
release-container-images:
if: needs.prepare-release.outputs.release_created
runs-on: ubuntu-22.04
permissions:
packages: write
id-token: write
needs:
- prepare-release
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Prepare image version
id: image-version
run: |
export version=$(echo ${{ needs.prepare-release.outputs.tag_name }} | sed 's/v//g')
echo "result=$version" >> $GITHUB_OUTPUT
- name: Install Cosign
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
with:
cosign-release: "${{ env.COSIGN_VERSION }}"
- name: Set up Go # required as the sbom generator is compiled using go < 1.21
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: "${{ env.GO_VERSION }}"
- name: Generate SBOM
uses: CycloneDX/gh-gomod-generate-sbom@efc74245d6802c8cefd925620515442756c70d8f # v2.0.0
with:
version: "${{ env.CYCLONEDX_GOMOD_VERSION }}"
args: app -licenses -assert-licenses -json -std -output CycloneDX-SBOM.json -main .
- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Login to DockerHub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Collect Docker meta-info
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ github.repository }}
labels: |
org.opencontainers.image.version=${{ steps.image-version.outputs.result }}
org.opencontainers.image.documentation=${{ env.DOCUMENTATION_URL }}
- name: Build and push images to container registry
id: publish-image
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm
push: true
build-args: VERSION=${{ needs.prepare-release.outputs.tag_name }}
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${{ steps.image-version.outputs.result }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.image-version.outputs.result }}
# DockerHub
- name: Sign the image published in DockerHub
if: steps.publish-image.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_REPOSITORY: ${{ github.repository }}-signatures
run: cosign sign --yes ${{ github.repository }}@${{ steps.publish-image.outputs.digest }}
- name: Attest and attach SBOM to the image published in DockerHub
if: steps.publish-image.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_REPOSITORY: ${{ github.repository }}-sbom
run: cosign attest --yes --predicate CycloneDX-SBOM.json --type cyclonedx ${{ github.repository }}@${{ steps.publish-image.outputs.digest }}
- name: Update DockerHub repository description & readme
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ github.repository }}
short-description: ${{ github.event.repository.description }}
readme-filepath: ./DockerHub-README.md
# GHCR
- name: Sign the image published in GitHub
if: steps.publish-image.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_REPOSITORY: ghcr.io/${{ github.repository }}-signatures
run: cosign sign --yes ghcr.io/${{ github.repository }}@${{ steps.publish-image.outputs.digest }}
- name: Attest and attach SBOM to the image published in GitHub
if: steps.publish-image.conclusion == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_REPOSITORY: ghcr.io/${{ github.repository }}-sbom
run: cosign attest --yes --predicate CycloneDX-SBOM.json --type cyclonedx ghcr.io/${{ github.repository }}@${{ steps.publish-image.outputs.digest }}
release-helm-chart:
runs-on: ubuntu-22.04
permissions:
contents: write
needs:
- prepare-release
- release-container-images
if: needs.prepare-release.outputs.release_created
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Prepare image version
id: image-version
run: |
export version=$(echo ${{ needs.prepare-release.outputs.tag_name }} | sed 's/v//g')
echo "result=$version" >> $GITHUB_OUTPUT
- name: Publish Helm Chart
uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 # v1.7.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
target_dir: charts
linting: off
app_version: ${{ steps.image-version.outputs.result }}
build-dev-documentation:
runs-on: ubuntu-22.04
permissions:
contents: write
needs:
- prepare-release
- check-changes
if: >
github.ref == 'refs/heads/main' &&
needs.prepare-release.outputs.release_created == false &&
(needs.check-changes.outputs.docs_changed == 'true' || needs.check-changes.outputs.ci_config_changed == 'true')
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
with:
hugo-version: 0.100.1
extended: true
- name: Setup Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 17.7
- name: Setup ruby
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
with:
ruby-version: 3.1.3
- name: Install asciidoctor
run: gem install asciidoctor asciidoctor-diagram asciidoctor-html5s rouge
- name: Install dependencies
working-directory: ./docs
run: npm install
- name: Update version string to dev version
uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3
with:
find: "x-current-version"
replace: "dev"
regex: false
include: docs/**
- name: Build documentation
working-directory: ./docs
run: hugo --minify -d ./public
- name: Deploy documentation
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/public
destination_dir: dev
release-documentation:
runs-on: ubuntu-22.04
permissions:
contents: write
id-token: write
pull-requests: write
needs:
- prepare-release
if: needs.prepare-release.outputs.release_created
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
with:
hugo-version: 0.100.1
extended: true
- name: Setup Node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: 17.7
- name: Install mermaid
run: npm install -g @mermaid-js/mermaid-cli@10.8.0
- name: Setup ruby
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
with:
ruby-version: 2.7
- name: Install asciidoctor
run: gem install asciidoctor asciidoctor-diagram asciidoctor-html5s rouge
- name: Install dependencies
working-directory: ./docs
run: npm install
- name: Update version string to new released version
uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3
with:
find: "x-current-version"
replace: "${{ needs.prepare-release.outputs.tag_name }}"
regex: false
include: docs/**
- name: Build documentation
working-directory: ./docs
run: hugo --minify -d ./public
- name: Update uri for redirecting to new version
uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3
with:
find: "x-released-version"
replace: "${{ needs.prepare-release.outputs.tag_name }}"
regex: false
include: docs/**
- name: Update versions JSON document
id: update-version-json
run: |
cat ./docs/versions/data.json | jq '. + [{ "version": "${{ needs.prepare-release.outputs.tag_name }}", "path": "/heimdall/${{ needs.prepare-release.outputs.tag_name }}" }]' | tee ./docs/versions/data.json
- name: Deploy documentation
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/public
destination_dir: ${{ needs.prepare-release.outputs.tag_name }}
- name: Deploy redirect to new released version
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/redirect
keep_files: true
- name: Deploy versions JSON document
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/versions
keep_files: true
- name: Setup GitSign
uses: chainguard-dev/actions/setup-gitsign@9d943fc9889a0c0795e3c2bd4b949a9b610ac02e # main
- name: Create a PR for the updated versions JSON document
if: steps.update-version-json.outcome == 'success'
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
title: 'chore(${{ github.ref_name }}): Update to data.json to include the new released documentation version'
commit-message: 'chore(${{ github.ref_name }}): Update to data.json to include the new released documentation version'
body: >
data.json updated by the release-documentation job to include the entry
referencing the released ${{ needs.prepare-release.outputs.tag_name }} documentation version
add-paths: |
docs/versions/*.json