-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (85 loc) · 3.04 KB
/
verify_distributed_dependencies.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Verify distributed dependencies
on:
push:
branches:
- tms-dependency-admin_*
paths:
- buildSrc/src/main/kotlin/default/dependencies.kt
- buildSrc/src/main/kotlin/groups.kt
jobs:
check-validity-and-merge:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
packages: write
steps:
- name: Sjekk ut branch
uses: 'actions/checkout@v4'
with:
fetch-depth: 2
- name: Sett opp java
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Sett opp gradle
uses: gradle/actions/setup-gradle@v3
- name: Bygg og kjør tester for å sjekke at nye versjoner er kompatible
run: ./gradlew build
- name: Build og push docker-image
uses: nais/docker-build-push@v0
id: docker-build-push
with:
team: min-side
identity_provider: ${{ secrets.NAIS_WORKLOAD_IDENTITY_PROVIDER }}
project_id: ${{ vars.NAIS_MANAGEMENT_PROJECT_ID }}
- name: Sjekk om deploy til dev-gcp er mulig
run: echo "CAN_DEPLOY_DEV=$([[ -f ./nais/dev-gcp/nais.yaml ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV
- name: Deploy-er til dev-gcp for å sjekke viability
if: env.CAN_DEPLOY_DEV == 'true'
uses: nais/deploy/actions/deploy@v2
env:
REF: ${{ github.sha }}
CLUSTER: dev-gcp
RESOURCE: ./nais/dev-gcp/nais.yaml
VAR: version=${{ steps.docker-build-push.outputs.image }}
PRINT_PAYLOAD: true
- name: Sjekk om deploy til prod-gcp er mulig
run: echo "CAN_DEPLOY_PROD=$([[ -f ./nais/prod-gcp/nais.yaml ]] && echo 'true' || echo 'false')" >> $GITHUB_ENV
- name: Deploy-er til prod-gcp for å sjekke viability
if: env.CAN_DEPLOY_PROD == 'true'
uses: nais/deploy/actions/deploy@v2
env:
CLUSTER: prod-gcp
RESOURCE: ./nais/prod-gcp/nais.yaml
VAR: version=${{ steps.docker-build-push.outputs.image }}
PRINT_PAYLOAD: true
- name: 'Merge kode fra branch og push til main'
run: |
git fetch
git checkout main
git merge ${{ github.ref_name }}
git push
git push origin --delete ${{ github.ref_name }}
open-pull-request-if-failed:
needs: check-validity-and-merge
if: always() && needs.check-validity-and-merge.result == 'failure'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: 'Åpner PR for manuell behandling'
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const branch = context.ref;
const result = await github.rest.pulls.create({
title: 'Dependencies - manuelle endringer kreves',
owner,
repo,
head: branch,
base: 'main',
body: 'Nye versjoner av dependencies krever manuell behandling'
});