-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (91 loc) · 3.12 KB
/
build.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
on:
pull_request:
types: ['opened', 'synchronize', 'closed']
name: Build Angular
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [lts/*]
permissions:
contents: 'write'
id-token: 'write'
steps:
- uses: actions/checkout@v1
- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
with:
path: bcp
- name: Check for Tag
run: |
if git show-ref --tags --verify --quiet "refs/tags/${{ steps.package-version.outputs.current-version}}"; then
echo "Tag ${{ steps.package-version.outputs.current-version}} exists"
exit 1
fi
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
cd bcp
npm i
- name: npm run deploy test mode
if: github.event.pull_request.merged == false
run: |
cd bcp
chmod a+x build.sh
npm run test
cd ../dist
zip -r distro.zip .
- name: npm run deploy prod mode
if: github.event.pull_request.merged == true
run: |
cd bcp
chmod a+x build.sh
npm run build
cd ../dist
zip -r distro.zip .
- name: Set to Staging
uses: fjogeleit/yaml-update-action@main
if: github.event.pull_request.merged == false
with:
valueFile: 'app.yaml'
propertyPath: 'service'
value: stageing
commitChange: false
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: 'projects/927628257279/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
service_account: '[email protected]'
project_id: 'ultima-ratio-221014'
- name: 'Deploy to Staging'
if: github.event.pull_request.merged == false
uses: 'google-github-actions/deploy-appengine@v1'
- name: Set to Production
uses: fjogeleit/yaml-update-action@main
if: github.event.pull_request.merged == true
with:
valueFile: 'app.yaml'
propertyPath: 'service'
value: default
commitChange: false
- name: Get release tag
id: version
run: |
echo "::set-output name=tag::$(echo ${{ steps.package-version.outputs.current-version}} | sed 's/\./-/g')"
- name: 'Deploy to Production'
if: github.event.pull_request.merged == true
uses: 'google-github-actions/deploy-appengine@v1'
with:
version: ${{ steps.version.outputs.tag}}
- name: Push Build to Releases
uses: ncipollo/release-action@v1
if: github.event.pull_request.merged == true
with:
artifacts: "dist/distro.zip"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.package-version.outputs.current-version}}