Skip to content

Commit fef1601

Browse files
author
Kjetil JD
committed
E!! rydder i github actions workflows
1 parent 44a9145 commit fef1601

6 files changed

+37
-41
lines changed

.github/workflows/bygg_alle_brancher.yml .github/workflows/bygg_branch_og_publiser.yml

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
name: Bygg alle brancher
1+
name: Bygg branch og publiser
22

33
on:
44
push:
55
branches:
66
- '*'
77
- '*/*'
8-
- '!release/*'
98
- '!master'
109

1110
jobs:
12-
bygg:
13-
name: 'Bygg alle brancher'
11+
bygg_og_publiser:
12+
name: 'Bygg branch og publiser image'
1413
runs-on: ubuntu-latest
14+
env:
15+
package: eessi-pensjon-journalforing
1516
steps:
1617
- name: 'Pull repo'
17-
uses: actions/checkout@v2
18-
19-
- name: 'Java 17'
20-
uses: actions/[email protected]
21-
with:
22-
java-version: 17
18+
uses: actions/checkout@v3
2319

2420
- name: 'Setter dato og commit variabel'
2521
run: |
@@ -28,8 +24,13 @@ jobs:
2824
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
2925
3026
- name: 'Setter Image'
31-
run: echo "IMAGE=ghcr.io/${{ github.repository }}/eessi-pensjon-journalforing:${{ env.DATE }}---${{ env.COMMIT_HASH }}" >> $GITHUB_ENV
27+
run: echo "IMAGE=ghcr.io/${{ github.repository }}/${{ env.package }}:${{ env.DATE }}---${{ env.COMMIT_HASH }}" >> $GITHUB_ENV
3228

29+
- name: 'Java'
30+
uses: actions/setup-java@v2
31+
with:
32+
java-version: 17
33+
distribution: temurin
3334

3435
- name: 'Bygg og publiser docker image'
3536
env:
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,61 @@
1-
name: Bygg og deploy Q2
1+
name: Bygg, deploy DEV, publiser, tag og dispatch deploy til PROD
22

33
on:
44
push:
55
branches:
66
- master
7+
78
jobs:
8-
tag_build_and_deploy:
9-
name: 'Build, deploy and tag'
9+
bygg_deploy_dev_publiser_tag:
10+
name: 'Bygg, publiser, deploy DEV, tag og dispatch deploy til PROD'
1011
runs-on: ubuntu-latest
12+
env:
13+
package: eessi-pensjon-journalforing
1114
steps:
12-
# PULLER REPO
1315
- name: 'Pull repo'
14-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1517

16-
# SETTER DATO OG COMMIT VARIABEL
1718
- name: 'Setter dato og commit variabel'
1819
run: |
1920
export TZ=CET
2021
echo "DATE=$(date "+%Y-%m-%d--%H-%M-%S")" >> $GITHUB_ENV
2122
echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
2223
23-
# SETTER IMAGE VARIABEL
2424
- name: 'Setter Image'
25-
run: echo "IMAGE=ghcr.io/${{ github.repository }}/eessi-pensjon-journalforing:${{ env.DATE }}---${{ env.COMMIT_HASH }}" >> $GITHUB_ENV
25+
run: echo "IMAGE=ghcr.io/${{ github.repository }}/${{ env.package }}:${{ env.DATE }}---${{ env.COMMIT_HASH }}" >> $GITHUB_ENV
2626

27-
# JAVA 17
28-
- name: 'Java 17'
29-
uses: actions/[email protected]
27+
- name: 'Java'
28+
uses: actions/setup-java@v2
3029
with:
3130
java-version: 17
31+
distribution: temurin
3232

33-
# BYGGER DOCKER CONTAINER
3433
- name: 'Bygg og publiser docker image'
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3536
run: |
37+
export TZ=CET
3638
./gradlew build --stacktrace
3739
docker build --tag ${{ env.IMAGE }} .
3840
docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${{ secrets.GITHUB_TOKEN }}
3941
docker push ${{ env.IMAGE }}
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4242
43-
# DEPLOYER TIL NAIS Q2 team namespace
44-
- name: 'Deploy to NAIS q2 gcp'
43+
- name: 'Deploy to DEV'
4544
uses: nais/deploy/actions/deploy@v1
4645
env:
4746
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
4847
CLUSTER: dev-gcp
4948
RESOURCE: nais/dev-gcp.yml
5049
IMAGE: ${{ env.IMAGE }}
5150

52-
# OPPRETTER GIT TAG
5351
- name: 'Opprett git tag'
5452
run: |
55-
curl -v -s -X POST https://api.github.com/repos/navikt/eessi-pensjon-journalforing/git/refs -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{ "ref": "refs/tags/${{ env.DATE }}---${{ env.COMMIT_HASH }}", "sha": "${{ env.COMMIT_HASH }}" }'
53+
curl -v -s -X POST https://api.github.com/repos/${{ github.repository }}/git/refs -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{ "ref": "refs/tags/${{ env.DATE }}---${{ env.COMMIT_HASH }}", "sha": "${{ env.COMMIT_HASH }}" }'
5654
57-
- name: 'Repository Dispatch PROD'
55+
- name: 'Dispatch PROD'
5856
uses: peter-evans/repository-dispatch@v1
5957
with:
6058
token: ${{ secrets.DISPATCH_TOKEN }}
6159
repository: ${{ github.repository }}
6260
event-type: deploy-prod
63-
client-payload: '{"image": "${{ env.IMAGE }}"}'
61+
client-payload: '{"image": "${{ env.IMAGE }}"}'

.github/workflows/deploy_prod.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ name: Deploy PROD
22
on:
33
repository_dispatch:
44
types: [deploy-prod]
5+
56
jobs:
6-
tag_deploy_q1:
7+
deploy_prod:
78
name: 'Deploy til PROD'
89
runs-on: ubuntu-latest
910
steps:
10-
# GET version
11-
- name: 'Get the version'
12-
uses: actions/checkout@v2
11+
- name: 'Pull repo'
12+
uses: actions/checkout@v3
1313

14-
# Show IMAGE from Q2 deploy
1514
- name: 'Vise image'
1615
run: |
1716
echo "image-tag: ${{ github.event.client_payload.image }}"

.github/workflows/deploy_topics.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ jobs:
1111
name: 'Deploy topics'
1212
runs-on: ubuntu-latest
1313
steps:
14-
# PULLER REPO
1514
- name: 'Pull repo'
16-
uses: actions/checkout@v2
15+
uses: actions/checkout@v3
1716

1817
- name: 'Deploy public-automatisering-q2 to eessipensjon namespace'
1918
uses: nais/deploy/actions/deploy@v1

.github/workflows/dispatch_issue_comment.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ jobs:
1010
uses: peter-evans/slash-command-dispatch@v1
1111
with:
1212
token: ${{ secrets.DISPATCH_TOKEN }}
13-
commands: prodsett
14-
reactions: false
13+
commands: prodsett

.github/workflows/prodsett_command.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: 'Pull repo'
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
1313

1414
- name: 'Lager variable'
1515
run: |

0 commit comments

Comments
 (0)