This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (62 loc) · 2.12 KB
/
ginuudan.yaml
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: build and push
on:
push:
branches:
- main
env:
GINUUDAN_IMAGE: ghcr.io/${{ github.repository }}
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: docker/setup-buildx-action@v1
- run: echo "IMAGE=${GINUUDAN_IMAGE}:$(date '+%Y-%m-%d')-$(git --no-pager log -1 --pretty=%h)" >> $GITHUB_ENV
- uses: docker/login-action@ab80d026d4753220c4243394c07c7d80f9638d06 # Use commit-sha1 instead of tag for security concerns
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.IMAGE }}
nais-yaml:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout ginuudan
uses: actions/checkout@v2
with:
path: ginuudan
- uses: navikt/github-app-token-generator@v1
id: get-token
with:
private-key: ${{ secrets.NAIS_APP_PRIVATE_KEY }}
app-id: ${{ secrets.NAIS_APP_ID }}
repo: navikt/nais-yaml
- uses: actions/checkout@v2
with:
repository: navikt/nais-yaml
token: ${{ steps.get-token.outputs.token }}
path: nais-yaml
- run: |
cd ginuudan
echo "VERSION=$(date '+%Y-%m-%d')-$(git --no-pager log -1 --pretty=%h)" >> $GITHUB_ENV
- run: |
cd ginuudan
res=".nais"
static_file="../nais-yaml/templates/ginuudan.yaml"
cat $res/ginuudan.yaml $res/clusterrole.yaml $res/clusterrolebinding.yaml $res/networkpolicy.yaml > $static_file
- run: |
cd nais-yaml
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
sed -E -i "s#image: ${GINUUDAN_IMAGE}:.+#image: ${GINUUDAN_IMAGE}:${VERSION}#" vars/global.yaml
git add .
git --no-pager diff --cached
git status
git commit -a -m "ci: Bump Ginuudan to version ${VERSION}"
git push