chore(deps): update dependency go to v1.23.3 #1292
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: Container | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
pull_request: | |
branches: | |
- main | |
- release-* | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
# renovate: datasource=go depName=github.com/goreleaser/goreleaser | |
GORELEASER_VERSION: v1.26.2 | |
IMAGE_NAME: ghcr.io/parca-dev/parca-load | |
jobs: | |
skip-check: | |
name: Skip check | |
continue-on-error: true | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
outputs: | |
should_skip: ${{ steps.skip-check.outputs.should_skip }} | |
permissions: | |
actions: write | |
contents: read | |
steps: | |
- id: skip-check | |
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 | |
with: | |
do_not_skip: '["schedule", "workflow_dispatch"]' | |
paths: |- | |
[ | |
"**.go", | |
".github/workflows/container.yml", | |
"Dockerfile", | |
"go.mod", | |
"go.sum" | |
] | |
skip_after_successful_duplicate: false | |
build-binary: | |
name: Build binary using goreleaser | |
needs: skip-check | |
runs-on: ubuntu-latest | |
timeout-minutes: 45 | |
if: ${{ needs.skip-check.outputs.should_skip != 'true' }} | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
cache: true | |
- name: Build binaries | |
uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # v3.2.0 | |
with: | |
distribution: goreleaser | |
version: ${{ env.GORELEASER_VERSION }} | |
args: build --rm-dist --skip-validate --snapshot --debug | |
- name: Archive generated artifacts | |
uses: actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1 | |
with: | |
name: parca-load-dist-container | |
if-no-files-found: error | |
path: | | |
dist | |
!dist/*.txt | |
build-and-push-container: | |
name: Container build and push (when merged) | |
needs: build-binary | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
container: | |
# https://github.com/containers/podman/tree/main/contrib/podmanimage | |
image: quay.io/containers/podman:v4.9.4 | |
options: >- | |
--device /dev/fuse:rw | |
--privileged | |
--security-opt label=disable | |
--security-opt seccomp=unconfined | |
permissions: | |
id-token: write | |
packages: write | |
contents: read | |
steps: | |
- name: Install dependencies | |
run: dnf install --assumeyes --repo fedora jq | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 | |
- uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: parca-load-dist-container | |
path: dist | |
- name: Set build environment variables | |
shell: bash | |
run: | | |
BRANCH_NAME="$(tr / - <<< "${GITHUB_REF#refs/heads/}")" | |
COMMIT="${GITHUB_SHA:0:8}" | |
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV | |
echo "COMMIT=${COMMIT}" >> $GITHUB_ENV | |
echo "IMAGE_TAG=${BRANCH_NAME}-${COMMIT}" >> $GITHUB_ENV | |
- name: Build container | |
run: podman build --platform linux/amd64,linux/arm64 --timestamp 0 --manifest "${IMAGE_NAME}:${IMAGE_TAG}" . | |
- name: Check images created | |
run: >- | |
[ -n "$(podman images --noheading --filter="reference=${IMAGE_NAME}:${IMAGE_TAG}")" ] | |
- name: Install cosign | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: sigstore/cosign-installer@c85d0e205a72a294fe064f618a87dbac13084086 # v2.8.1 | |
- name: Install crane | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: imjasonh/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # v0.3 | |
- name: Login to registry | |
if: ${{ github.event_name != 'pull_request' }} | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | podman login -u parca-dev --password-stdin ghcr.io | |
- name: Push and sign container | |
if: ${{ github.event_name != 'pull_request' }} | |
env: | |
COSIGN_EXPERIMENTAL: true | |
run: | | |
podman manifest push --all "${IMAGE_NAME}:${IMAGE_TAG}" "docker://${IMAGE_NAME}:${IMAGE_TAG}" | |
crane digest "${IMAGE_NAME}:${IMAGE_TAG}" | |
cosign sign --force -a "GIT_HASH=${COMMIT}" -a "GIT_VERSION=${IMAGE_TAG}" ghcr.io/parca-dev/parca-load@$(crane digest "${IMAGE_NAME}:${IMAGE_TAG}") |