-
Notifications
You must be signed in to change notification settings - Fork 2
120 lines (93 loc) · 3.24 KB
/
actions.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: CI/CD Actions
on:
push:
branches:
- '**'
jobs:
main:
name: Test & Assemble
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Java Setup
uses: actions/setup-java@v1
with:
java-version: 11
- name: Gradle Check
uses: eskatos/gradle-command-action@v1
with:
arguments: clean check
- name: Gradle Test
uses: eskatos/gradle-command-action@v1
with:
arguments: clean test
- name: Gradle Assemble
uses: eskatos/gradle-command-action@v1
with:
arguments: clean assemble
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: dist-without-markdown
path: ./*
retention-days: 5
#release:
# name: Release
# needs: main
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - run: npm ci
# - if: github.ref == 'refs/heads/master'
# run: npx -p @semantic-release/changelog -p @semantic-release/git -p semantic-release semantic-release
deploy:
name: Deploy
needs: main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Java Setup
uses: actions/setup-java@v1
with:
java-version: 11
- name: Gradle Assemble
uses: eskatos/gradle-command-action@v1
with:
arguments: clean assemble
- name: Prepare Cloud Build
uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.GCLOUD_AUTH }}
- name: Cloud Run Deployment
run: |
gcloud config set project ${PROJECT_ID}
touch empty.ignore
gsutil cp gs://keystorage-${PROJECT_ID}/credentials.json credentials.json
gcloud builds submit --ignore-file empty.ignore --tag gcr.io/${PROJECT_ID}/machbarschaft-api:${{ github.ref == 'refs/heads/master' && 'stable' || 'develop' }}
gcloud run deploy ${{ github.ref == 'refs/heads/master' && 'machbarschaft-api-prd' || 'machbarschaft-api-sta' }} \
--image gcr.io/${PROJECT_ID}/machbarschaft-api:${{ github.ref == 'refs/heads/master' && 'stable' || 'develop' }} \
--update-env-vars google_maps_api_key=${MAPS_API_KEY} \
--region europe-west1 \
--platform managed
env:
MAPS_API_KEY: ${{ github.ref == 'refs/heads/master' && secrets.MAPS_API_KEY_PRD || secrets.MAPS_API_KEY_STA }}
PROJECT_ID: ${{ github.ref == 'refs/heads/master' && secrets.PROJECT_ID_PRD || secrets.PROJECT_ID_STA }}
create-pr:
name: Create PR
if: ${{ github.ref != 'refs/heads/master' }}
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- if: ${{ github.ref != 'refs/heads/develop' }}
name: pull-request develop
uses: repo-sync/pull-request@v2
with:
destination_branch: "develop"
github_token: ${{ secrets.GITHUB_TOKEN }}
- if: ${{ github.ref == 'refs/heads/develop' }}
name: pull-request master
uses: repo-sync/pull-request@v2
with:
destination_branch: "master"
github_token: ${{ secrets.GITHUB_TOKEN }}