Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

new quarto: id could optionally be provided for the quarto story upon… #317

new quarto: id could optionally be provided for the quarto story upon…

new quarto: id could optionally be provided for the quarto story upon… #317

name: build and push
on:
push:
branches:
- '*'
workflow_dispatch:
inputs:
environment:
description: Environment du kjører i
type: choice
options:
- dev
- prod
required: true
permissions:
contents: read
packages: write
jobs:
integration-tests:
name: Integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true
- name: Run tests
run: make integration-test
set-version:
name: Set version
runs-on: ubuntu-latest
needs: integration-tests
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: set version
id: set-version
run: echo "version="$(date '+%Y-%m-%d')-$(git --no-pager log -1 --pretty=%h) >> $GITHUB_OUTPUT
build-and-deploy:
name: Build and deploy
runs-on: ubuntu-20.04
needs: set-version
steps:
- uses: actions/checkout@v4
- name: Set up environment
run: |
version=${{ needs.set-version.outputs.version }}
prefix=ghcr.io/${{ github.repository }}
echo "IMAGE=$prefix:$version" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # Use commit-sha1 instead of tag for security concerns
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Dockerimage
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE }}
- name: Deploy to dev-gcp
if: inputs.environment != 'prod'
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .nais/dev-gcp.yml
- name: Deploy to prod-gcp
if: github.ref == 'refs/heads/main' && inputs.environment != 'dev'|| inputs.environment == 'prod'
uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: .nais/prod-gcp.yml