1
+ name : Manual build and deploy to dev environment
2
+ on :
3
+ workflow_dispatch :
4
+
5
+ env :
6
+ IMAGE : docker.pkg.github.com/${{ github.repository }}/kabal-smart-editor-api:${{ github.sha }}
7
+
8
+ jobs :
9
+ build :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Checkout
13
+ uses : actions/checkout@v2
14
+ - name : Cache
15
+
16
+ with :
17
+ path : ~/.gradle/caches
18
+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
19
+ restore-keys : |
20
+ ${{ runner.os }}-gradle-
21
+ - name : Install Java 17
22
+
23
+ with :
24
+ java-version : 17
25
+ distribution : temurin
26
+ - name : test and build
27
+ run : ./gradlew test bootJar
28
+ env :
29
+ ORG_GRADLE_PROJECT_githubUser : x-access-token
30
+ ORG_GRADLE_PROJECT_githubPassword : ${{ secrets.GITHUB_TOKEN }}
31
+ - name : Build docker image
32
+ run : docker build -t $IMAGE .
33
+ - name : Login to Github package registry
34
+ run : docker login docker.pkg.github.com -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
35
+ env :
36
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37
+ - name : Push docker image
38
+ run : docker push $IMAGE
39
+ - name : Post failures to Slack
40
+ if : failure()
41
+ run : |
42
+ curl -X POST --data-urlencode "payload={\"channel\": \"$CHANNEL\", \"text\": \"$MESSAGE\", \"icon_emoji\": \":ghost:\"}" $WEBHOOK_URL
43
+ env :
44
+ MESSAGE : " Bygg feilet"
45
+ CHANNEL : " #klage-notifications"
46
+ WEBHOOK_URL : ${{ secrets.WEBHOOK_URL }}
47
+ deploytodev :
48
+ name : Deploy to dev
49
+ needs : build
50
+ runs-on : ubuntu-latest
51
+ steps :
52
+ - uses : actions/checkout@v2
53
+ name : Checkout code
54
+ - uses : nais/deploy/actions/deploy@v1
55
+ env :
56
+ APIKEY : ${{ secrets.NAIS_DEPLOY_API_KEY }}
57
+ CLUSTER : dev-gcp
58
+ RESOURCE : deploy/nais.yaml
59
+ VARS : deploy/dev.yaml
60
+ - name : Post failures to Slack
61
+ if : failure()
62
+ run : |
63
+ curl -X POST --data-urlencode "payload={\"channel\": \"$CHANNEL\", \"text\": \"$MESSAGE\", \"icon_emoji\": \":ghost:\"}" $WEBHOOK_URL
64
+ env :
65
+ MESSAGE : " Deploy til dev feilet"
66
+ CHANNEL : " #klage-notifications"
67
+ WEBHOOK_URL : ${{ secrets.WEBHOOK_URL }}
0 commit comments