Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

use ghcr manually because the navikt-owner/nais-repo combo makes goog… #80

use ghcr manually because the navikt-owner/nais-repo combo makes goog…

use ghcr manually because the navikt-owner/nais-repo combo makes goog… #80

Workflow file for this run

name: "Build and deploy devrapid-git-push"
on:
push:
branches:
- "main"
env:
BASEIMAGE: "gcr.io/distroless/java17-debian11:nonroot"
jobs:
build:
name: "build"
runs-on: "ubuntu-latest"
permissions:
id-token: write
outputs:
tag: "${{ fromJSON(steps.dockermeta.outputs.json).tags[0] }}"
steps:
- uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" # ratchet:actions/checkout@v3
- name: Setup Gradle
uses: gradle/gradle-build-action@915a66c096a03101667f9df2e56c9efef558b165 # ratchet:gradle/gradle-build-action@v2
with:
dependency-graph: generate-and-submit
- uses: "gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b" # ratchet:gradle/wrapper-validation-action@v1
- uses: "actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8" # ratchet:actions/cache@v3
with:
"path": "~/.gradle/caches"
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}"
"restore-keys": "${{ runner.os }}-gradle-"
- uses: "actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2" # ratchet:actions/setup-java@v3
with:
"java-version": "17"
"distribution": "temurin"
- name: "compile and run tests"
run: "./gradlew build"
- name: "Create SBOM"
run: ./gradlew cyclonedxBom
- name: Install cosign
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 # ratchet:sigstore/cosign-installer@main
with:
cosign-release: 'v2.0.0'
- name: Verify distroless base image
run: cosign verify --certificate-identity "keyless@distroless.iam.gserviceaccount.com" --certificate-oidc-issuer "https://accounts.google.com" $BASEIMAGE
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # ratchet:docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # ratchet:docker/setup-qemu-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # ratchet:docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: dockermeta
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 # ratchet:docker/metadata-action@v4
with:
images: ghcr.io/navikt/devrapid-git-push
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
id: docker-build-push
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # ratchet:docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.dockermeta.outputs.tags }}
deployToProd:
name: "Deploy to prod"
needs:
- "build"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9" # ratchet:actions/checkout@v3
- name: "Deploy to prod-gcp"
uses: "nais/deploy/actions/deploy@913eb0f92e9d132dbe0cbba3390a340675849f30" # ratchet:nais/deploy/actions/deploy@v1
env:
"APIKEY": "${{ secrets.NAIS_DEPLOY_APIKEY }}"
"CLUSTER": "prod-gcp"
"RESOURCE": ".nais/nais.yaml,.nais/topic.yaml"
"VARS": ".nais/prod.yaml"
"IMAGE": "${{ needs.docker-build-push.outputs.tag }}"