Skip to content

Merge pull request #19 from GitGuardian/ggueutier/update-deps #27

Merge pull request #19 from GitGuardian/ggueutier/update-deps

Merge pull request #19 from GitGuardian/ggueutier/update-deps #27

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
DAGGER_VERSION: '0.18.3'
jobs:
build-packages:
strategy:
matrix:
include:
- os: ubuntu-24.04
arch: amd64
- os: ubuntu-24.04-arm
arch: arm64
name: Build packages for ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set GitHub vars
id: github
uses: ./.github/actions/github
- name: Write Melange Signing Key
id: melange-signing-key
shell: bash
env:
SIGNING_KEY_BASE64: ${{ secrets.MELANGE_SIGNING_KEY_BASE64 }}
run: |
mkdir -p ${{ runner.temp }}/packages
echo -n "$SIGNING_KEY_BASE64" | base64 -d > ${{ runner.temp }}/packages/melange.rsa
- name: Build packages
id: apk
uses: ./.github/actions/melange/build
with:
version: ${{ steps.github.outputs.ga-version }}
arch: ${{ steps.github.outputs.arch }}
signing-key: ${{ runner.temp }}/packages/melange.rsa
output-dir: ${{ runner.temp }}/packages
dagger-version: ${{ env.DAGGER_VERSION }}
dagger-cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages-${{ steps.github.outputs.arch }}
path: ${{ runner.temp }}/packages/${{ steps.github.outputs.arch }}/
retention-days: 1
publish-images:
strategy:
matrix:
include:
- variant: 'prod'
tag-suffix: ''
- variant: 'shell'
tag-suffix: '-shell'
name: Publish ${{ matrix.variant }} image
needs: [build-packages]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set GitHub vars
id: github
uses: ./.github/actions/github
- name: Login to GitHub registry
uses: docker/login-action@v3
id: login-to-github
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Login to DockerHub registry
uses: docker/login-action@v3
id: login-to-docker-hub
with:
username: ${{ vars.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Write Melange Public Key
id: melange-public-key
shell: bash
env:
PUBLIC_KEY_BASE64: ${{ vars.MELANGE_PUBLIC_KEY_BASE64 }}
run: |
mkdir -p ${{ runner.temp }}/packages
echo -n "$PUBLIC_KEY_BASE64" | base64 -d > ${{ runner.temp }}/packages/melange.rsa.pub
- name: Download aarch64 packages
uses: actions/download-artifact@v4
with:
name: packages-aarch64
path: ${{ runner.temp }}/packages/aarch64
- name: Download x86_64 packages
uses: actions/download-artifact@v4
with:
name: packages-x86_64
path: ${{ runner.temp }}/packages/x86_64
- name: Publish image
id: publish
uses: ./.github/actions/apko/publish
with:
config: 'apko/${{ matrix.variant }}.yaml'
tag: '${{ steps.github.outputs.repository }}:${{ steps.github.outputs.version }}${{ matrix.tag-suffix }}'
repository-append: ${{ runner.temp }}/packages
keyring-append: ${{ runner.temp }}/packages/melange.rsa.pub
sbom-path: ${{ runner.temp }}/sbom
dockerhub-username: ${{ vars.DOCKER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
dagger-version: ${{ env.DAGGER_VERSION }}
dagger-cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
- if: steps.github.outputs.version == steps.github.outputs.ga-version
name: Tag image as latest
uses: ./.github/actions/crane/tag
with:
image: '${{ steps.github.outputs.repository }}:${{ steps.github.outputs.version }}${{ matrix.tag-suffix }}'
tag: 'latest${{ matrix.tag-suffix }}'
dockerhub-username: ${{ vars.DOCKER_REGISTRY_USERNAME }}
dockerhub-password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
dagger-version: ${{ env.DAGGER_VERSION }}
dagger-cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
- name: Scan vulnerabilities
id: scan
uses: ./.github/actions/scan
with:
image: 'ghcr.io/${{ steps.github.outputs.repository }}:${{ steps.github.outputs.version }}${{ matrix.tag-suffix }}'
- name: Sign and Attest image
id: sign
uses: ./.github/actions/cosign/sign
with:
image: '${{ steps.github.outputs.repository }}'
tag: ${{ steps.github.outputs.version }}${{ matrix.tag-suffix }}
sbom-path: ${{ runner.temp }}/sbom
attest-provenance: 'true'
publish-helm-chart:
name: Publish Helm Chart
needs: [publish-images]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set GitHub vars
id: github
uses: ./.github/actions/github
- name: Test Helm chart
uses: ./.github/actions/helm/test
with:
dagger-version: ${{ env.DAGGER_VERSION }}
dagger-cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
- name: Publish Helm chart
uses: ./.github/actions/helm/publish
with:
registry: ghcr.io/${{ steps.github.outputs.repository }}/helm
version: ${{ steps.github.outputs.version }}
app-version: ${{ steps.github.outputs.version }}
dagger-version: ${{ env.DAGGER_VERSION }}
dagger-cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}