3.0.0-rc1 #187
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 | |
# Only trigger this action when a new release is published | |
on: | |
release: | |
types: [published] | |
env: | |
REGISTRY: quay.io | |
IMAGE_NAME: "gogatekeeper/gatekeeper" | |
REGISTRY_USER: "gogatekeeper+image_build" | |
jobs: | |
SBOM-upload: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate SBOM | |
# generation command documentation: https://github.com/microsoft/sbom-tool#sbom-generation | |
run: | | |
curl -Lo $RUNNER_TEMP/sbom-tool https://github.com/microsoft/sbom-tool/releases/download/v1.2.0/sbom-tool-linux-x64 | |
chmod +x $RUNNER_TEMP/sbom-tool | |
$RUNNER_TEMP/sbom-tool generate -b . -bc . -pn $ -pv 1.0.0 -ps "Pavol Ipoth" -nsb https://github.com/gogatekeeper -V Verbose | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: sbom | |
path: _manifest/spdx_2.2 | |
- name: SBOM upload | |
uses: advanced-security/[email protected] | |
with: | |
filePath: "_manifest/spdx_2.2/" | |
goreleaser: | |
runs-on: ubuntu-latest | |
steps: | |
# Setup the workflow to use the specific version of Go | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22.6" | |
# Checkout the repository | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Cleans up unreachable Git objects and convert a shallow clone to a regular one if needed | |
- name: Unshallow | |
run: git fetch --prune --unshallow | |
# Publish the binaries | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v3 | |
with: | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
- name: "Create k3d Cluster for E2E testing" | |
uses: AbsaOSS/[email protected] | |
with: | |
cluster-name: "testcluster" | |
args: >- | |
-p "8081:80@loadbalancer" | |
- name: "Run Tests" | |
run: | | |
k3d kubeconfig merge testcluster --kubeconfig-switch-context | |
KUBECONFIG=~/.k3d/kubeconfig-testcluster.yaml kubectl apply -f ./e2e/k8s/manifest.yml | |
go test -v -race ./... | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ secrets.REGISTRY_PASS }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. | |
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. | |
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 |