chore(deps): update golang version sync to v1.27.0 #630
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build/Publish Docker Image | |
| permissions: read-all | |
| on: | |
| release: | |
| types: | |
| - published | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v* | |
| paths-ignore: | |
| - "docs/**" | |
| - "**/*.md" | |
| pull_request: | |
| paths-ignore: | |
| - "docs/**" | |
| - "**/*.md" | |
| types: [labeled, unlabeled, opened, synchronize, reopened] | |
| jobs: | |
| buildAndPush: | |
| strategy: | |
| matrix: | |
| image: | |
| - name: dependency-controller | |
| target: controller | |
| - name: dependency-webhook | |
| target: webhook | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| attestations: write | |
| name: Build and Publish Docker Image | |
| if: | | |
| github.event_name == 'push' || | |
| (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ok-to-image')) || | |
| (github.event_name == 'release' && github.event.action == 'published') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 | |
| id: meta | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository_owner }}/${{ matrix.image.name }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=ref,event=branch | |
| type=ref,event=tag | |
| type=ref,event=pr | |
| type=sha | |
| flavor: | | |
| latest=${{ github.ref == 'refs/heads/main' }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0 | |
| with: | |
| platforms: arm64 | |
| - name: Set up Docker Buildx | |
| timeout-minutes: 5 | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Login to GHCR | |
| uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| id: image | |
| timeout-minutes: 20 | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| target: ${{ matrix.image.target }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Install cosign | |
| uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2 | |
| - name: Sign image with cosign | |
| env: | |
| COSIGN_EXPERIMENTAL: "1" | |
| TAGS: ${{ steps.meta.outputs.tags }} | |
| GH_REPO: ${{ github.repository }} | |
| GH_WORKFLOW: ${{ github.workflow }} | |
| GH_SHA: ${{ github.sha }} | |
| IMAGE_DIGEST: ${{ steps.image.outputs.digest }} | |
| run: | | |
| mapfile -t TAG_LIST <<< "$TAGS" | |
| for tag in "${TAG_LIST[@]}"; do | |
| cosign sign \ | |
| -a "repo=${GH_REPO}" \ | |
| -a "workflow=${GH_WORKFLOW}" \ | |
| -a "sha=${GH_SHA}" \ | |
| --yes \ | |
| "${tag}@${IMAGE_DIGEST}" | |
| done | |
| - name: Extract first tag | |
| id: first-tag | |
| env: | |
| TAGS: ${{ steps.meta.outputs.tags }} | |
| run: | | |
| mapfile -t TAG_LIST <<< "$TAGS" | |
| echo "tag=${TAG_LIST[0]}" >> "$GITHUB_OUTPUT" | |
| - name: Generate SBOM | |
| uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0 | |
| with: | |
| image: ${{ steps.first-tag.outputs.tag }} | |
| format: 'cyclonedx-json' | |
| output-file: 'sbom.cyclonedx.json' | |
| upload-release-assets: false | |
| # actions/attest picks the attestation type from its inputs: sbom-path | |
| # yields an SBOM attestation, its absence a SLSA build provenance one. | |
| # create-storage-record only feeds the org Linked Artifacts page, which | |
| # we dont use. It defaults to true whenever push-to-registry is set and | |
| # has only ever failed here with "no artifacts found", so turn it off | |
| # rather than keep two bogus warnings per image in every build. | |
| - name: Attest SBOM | |
| uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 | |
| with: | |
| subject-name: ghcr.io/${{ github.repository_owner }}/${{ matrix.image.name }} | |
| subject-digest: ${{ steps.image.outputs.digest }} | |
| sbom-path: 'sbom.cyclonedx.json' | |
| push-to-registry: true | |
| create-storage-record: false | |
| - name: Attest provenance | |
| uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 | |
| with: | |
| subject-name: ghcr.io/${{ github.repository_owner }}/${{ matrix.image.name }} | |
| subject-digest: ${{ steps.image.outputs.digest }} | |
| push-to-registry: true | |
| create-storage-record: false |