-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (43 loc) · 1.37 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Build, push, and deploy
on: [push]
env:
docker_image: ghcr.io/navikt/${{ github.repository }}:${{ github.sha }}
jobs:
build-and-run-tests:
name: Build and push Docker container
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Build and publish Docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ${GITHUB_TOKEN} | docker login ghcr.io --username ${GITHUB_REPOSITORY} --password-stdin
docker build --tag ${docker_image} .
docker push ${docker_image}
deploy-test:
name: Deploy job to test env
needs: build-and-run-tests
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: nais-test.yml
VAR: image=${{ env.docker_image }}
deploy-prod:
name: Deploy application to prod
needs: build-and-run-tests
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: nais/deploy/actions/deploy@v1
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: prod-gcp
RESOURCE: nais.yml
VAR: image=${{ env.docker_image }}