Skip to content

---

--- #60

Workflow file for this run

name: Go
on: [push]
permissions:
contents: read
pull-requests: read
checks: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prepare OCI metadata
id: meta
uses: docker/metadata-action@v5
with:
images: "quay.io/stackrox-io/image-prefetcher"
# generate Docker tags based on the following events/attributes
# See https://github.com/docker/metadata-action
tags: |
type=ref,event=branch,prefix=branch-
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}}
type=sha
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Verify
run: go mod verify
- name: Build
run: go build ./...
- name: Test
run: go test ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
install-mode: binary
- name: Prepare manifests for linting
run: |
mkdir manifests
go run deploy/main.go my-images v0.0.8 vanilla > manifests/vanilla.yaml
go run deploy/main.go my-images v0.0.8 ocp > manifests/ocp.yaml
go run deploy/main.go my-images v0.0.8 vanilla my-secret > manifests/vanilla-with-secret.yaml
go run deploy/main.go my-images v0.0.8 ocp my-secret > manifests/ocp-with-secret.yaml
- name: kube-linter
uses: stackrox/[email protected]
with:
directory: manifests
- name: Build binary
run: CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' .
- name: Login to Quay
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
- name: Build and push OCI image
if: github.event_name != 'pull_request'
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}