Add metrics support. #49
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: 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: 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/*.go --k8s-flavor vanilla my-images > manifests/vanilla.yaml | |
go run deploy/*.go --k8s-flavor ocp my-images > manifests/ocp.yaml | |
go run deploy/*.go --k8s-flavor vanilla --secret my-secret my-images > manifests/vanilla-with-secret.yaml | |
go run deploy/*.go --k8s-flavor ocp --secret my-secret my-images > 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 }} |