-
-
Notifications
You must be signed in to change notification settings - Fork 4
76 lines (72 loc) · 2.36 KB
/
pr.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
name: PR CI/CD
on:
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- master
jobs:
build:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
name: Build App
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Restore Gradle cache
id: cache
uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11
- name: Build Apps
run: ./gradlew :app:client:assemble
- name: Upload Static Web App Artifact
uses: actions/upload-artifact@v2
id: upload
with:
path: app/client/build/dist/js/WEB-INF/
name: static-web-app
if-no-files-found: error
deploy:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
name: Deploy Staging
runs-on: ubuntu-latest
needs: [ build ]
steps:
- name: Download Static Web App Artifact
uses: actions/download-artifact@v2
with:
name: static-web-app
path: dist/
- name: Prepare Env
uses: DamianReeves/[email protected]
with:
path: dist/application.env
contents: |
API_URL=https://kamp.azurewebsites.net
write-mode: overwrite
- name: Deploy Azure Static Web App
uses: Azure/[email protected]
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APP_API_TOKEN }}
repo_token: ${{ github.token }}
action: "upload"
app_location: "/dist"
undeploy:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Undeploy Staging
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/[email protected]
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APP_API_TOKEN }}
action: "close"