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

fix pr

fix pr #797

Workflow file for this run

name: build and push
on:
push:
branches:
- '*'
jobs:
snyk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor
args: --org=nada
integration-tests:
name: Integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.17"
- 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@v3
- name: set version
id: set-version
run: echo ::set-output name=version::"$(date '+%Y-%m-%d')-$(git --no-pager log -1 --pretty=%h)"
build-and-deploy:
name: Build and deploy
runs-on: ubuntu-20.04
needs: set-version
steps:
- uses: actions/checkout@v3
- name: Set up environment
run: |
version=${{ needs.set-version.outputs.version }}
prefix=ghcr.io/${{ github.repository }}
echo "image_version=$version" >> $GITHUB_ENV
echo "image_prefix=$prefix" >> $GITHUB_ENV
echo "IMAGE=$prefix:$version" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # 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@v3
with:
context: .
push: true
tags: ${{ env.image_prefix }}:latest, ${{ env.IMAGE }}
- name: Deploy to dev-gcp
uses: nais/deploy/actions/deploy@master
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'
uses: nais/deploy/actions/deploy@master
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: .nais/prod-gcp.yml