Build and deploy nais.audit #104
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: Build and deploy nais.audit | |
on: | |
schedule: | |
- cron: '0 2 * * 2' | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- 'resources/pipeline/audit.nais/Dockerfile' | |
jobs: | |
build: | |
name: Build audit.nais mock | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
env: | |
image: 'ghcr.io/${{ github.repository }}/audit-nais-mock' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # ratchet:actions/checkout@v4 | |
- name: Generate build version | |
id: generate-build-version | |
run: | | |
echo "build-version=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV | |
- name: Print build version | |
run: echo "Generated build-version is ${{ env.build-version }}" | |
- name: Login to GitHub Packages Docker Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # ratchet:docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # ratchet:docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # ratchet:docker/build-push-action@v4 | |
with: | |
context: resources/pipeline/audit.nais | |
platforms: linux/amd64, linux/arm64 | |
pull: true | |
push: true | |
tags: ${{ env.image }}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |