Skip to content

bundle fix

bundle fix #72

Workflow file for this run

name: Build
on:
push:
branches: [main]
tags: [v*]
pull_request:
branches: [main]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/webmeshproj/webmesh-cni
VERSION: ${{ startswith(github.ref, 'refs/tags/v') && github.ref || 'latest' }}
GO_VERSION: "1.21"
GOLANGCI_LINT_VERSION: v1.54.2
DOCKER_PLATFORMS: linux/amd64,linux/arm64,linux/arm,linux/386,linux/ppc64le,linux/s390x
CACHE_DEP_PATH: go.sum
LINT_TIMEOUT: 10m
BUILD_PARALLELISM: 6
COSIGN_EXPERIMENTAL: 1
jobs:
lint:
name: Static Analysis
runs-on: ubuntu-latest
permissions:
contents: "read"
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: false
- name: Run Linting
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout ${{ env.LINT_TIMEOUT }}
build-containers:
name: Build Containers
runs-on: ubuntu-latest
needs: [lint]
permissions:
contents: "write"
id-token: "write"
packages: "write"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
check-latest: true
cache: false
- name: Setup Build Cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-containers-go-${{ env.GO_VERSION }}-${{ hashFiles(env.CACHE_DEP_PATH) }}
restore-keys: ${{ runner.os }}-containers-go-${{ env.GO_VERSION }}-
path: |
~/go/pkg
~/.cache/go-build
- name: Setup Cosign
uses: sigstore/cosign-installer@main
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Buildx
uses: docker/setup-buildx-action@v3
- name: Run Snapshot Container Release
uses: goreleaser/goreleaser-action@v5
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
with:
version: latest
args: build --snapshot --clean --parallelism=${{ env.BUILD_PARALLELISM }}
- name: Run Container Release
uses: goreleaser/goreleaser-action@v5
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
version: latest
args: build --clean --parallelism=${{ env.BUILD_PARALLELISM }}
- name: Login to GHCR
uses: docker/login-action@v3
if: ${{ github.event_name != 'pull_request' }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Build Container Images
uses: docker/build-push-action@v5
id: build
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
platforms: ${{ env.DOCKER_PLATFORMS }}
- name: Sign Container Images
if: ${{ github.event_name != 'pull_request' }}
run: cosign sign --yes --recursive ${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}