for testing purposes #98
Workflow file for this run
This file contains 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: release | |
on: | |
push: | |
tags: | |
- v*.*.* | |
branches: | |
- test-provenance-docker | |
env: | |
DOCKER_BUILDKIT: 1 | |
DOCKER_REGISTRY: docker.elastic.co | |
DOCKER_IMAGE_NAME: observability/apm-lambda-extension | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/arm64, linux/amd64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: elastic/apm-pipeline-library/.github/actions/docker-login@current | |
with: | |
registry: docker.elastic.co | |
secret: secret/observability-team/ci/docker-registry/prod | |
url: ${{ secrets.VAULT_ADDR }} | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
- uses: hashicorp/[email protected] | |
with: | |
url: ${{ secrets.VAULT_ADDR }} | |
method: approle | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
secrets: | | |
secret/observability-team/ci/service-account/apm-aws-lambda access_key_id | AWS_ACCESS_KEY_ID ; | |
secret/observability-team/ci/service-account/apm-aws-lambda secret_access_key | AWS_SECRET_ACCESS_KEY | |
# See https://goreleaser.com/blog/supply-chain-security/ | |
- name: installs syft for generating the SBOM with goreleaser | |
uses: anchore/sbom-action/[email protected] | |
- name: Release | |
run: make release | |
# Store artifacts to help with troubleshooting | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: release | |
path: "dist/*.*" | |
retention-days: 5 | |
- name: generate build provenance (binaries) | |
uses: github-early-access/generate-build-provenance@main | |
with: | |
subject-path: "${{ github.workspace }}/dist/*.*" | |
# See https://github.com/github-early-access/generate-build-provenance/issues/162 | |
- name: container image digest | |
id: image | |
run: | | |
set -euo pipefail | |
# Gather the container image generated with goreleaser | |
image=$(jq -r '.[] | select (.type=="Docker Image") | .path' dist/artifacts.json | cut -d':' -f1 | uniq) | |
image_1=$(echo $image | head -n1) | |
image_2=$(echo $image | tail -n1) | |
# Fetch the digest for the container image (amd64 and arm64) | |
digest_1=$(docker images --format "{{.Digest}}" --no-trunc $image | sed -n 1p) | |
digest_2=$(docker images --format "{{.Digest}}" --no-trunc $image | sed -n 2p) | |
echo "name_1=$image" >> "$GITHUB_OUTPUT" | |
echo "name_2=$image" >> "$GITHUB_OUTPUT" | |
echo "digest_1=$digest_1" >> "$GITHUB_OUTPUT" | |
echo "digest_2=$digest_2" >> "$GITHUB_OUTPUT" | |
- name: generate build provenance (containers x86_64) | |
uses: github-early-access/generate-build-provenance@main | |
with: | |
subject-name: ${{ steps.image.outputs.name_1 }} | |
subject-digest: ${{ steps.image.outputs.digest_1 }} | |
- name: generate build provenance (containers arm64) | |
uses: github-early-access/generate-build-provenance@main | |
with: | |
subject-name: ${{ steps.image.outputs.name_2 }} | |
subject-digest: ${{ steps.image.outputs.digest_2 }} |