Skip to content

demo ready, doc to be completed #22

demo ready, doc to be completed

demo ready, doc to be completed #22

Workflow file for this run

name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-testing[0-9]+"
permissions:
contents: write
env:
GH_REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
RELEASE_VERSION: ${{ github.ref_name }}
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.24.3'
- uses: anchore/sbom-action/[email protected]
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
packagerelease:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Log in to the GitHub Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.GH_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.GH_REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ env.RELEASE_VERSION }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
controlplane/netassert:${{ github.ref_name }}
controlplane/netassert:latest
build-args: |
VERSION=${{ env.RELEASE_VERSION }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.GH_REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Setup yq
uses: mikefarah/yq@v4
- name: Log in to GitHub Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Prepare and package Helm chart
run: |
CLEAN_VERSION=$(echo "$RELEASE_VERSION" | sed 's/^v//')
echo "Using chart version and appVersion: $CLEAN_VERSION"
yq -i ".image.tag = \"${RELEASE_VERSION}\"" values.yaml
yq -i ".version = \"${CLEAN_VERSION}\"" ./helm/Chart.yaml
yq -i ".appVersion = \"${CLEAN_VERSION}\"" ./helm/Chart.yaml
helm package ./helm -d .
- name: Push Helm chart to GHCR
run: |
CLEAN_VERSION=$(echo "$RELEASE_VERSION" | sed 's/^v//')
helm push "./netassert-${CLEAN_VERSION}.tgz" oci://ghcr.io/${{ github.repository_owner }}/charts