-
Notifications
You must be signed in to change notification settings - Fork 25
183 lines (183 loc) · 5.67 KB
/
deploy.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Deploy Groups
on:
workflow_run:
workflows: ["Sync Develop with Staging"]
types:
- completed
workflow_dispatch:
inputs:
tag:
type: string
required: false
default: develop
description: Enter the tag to deploy
push:
branches:
- "develop"
env:
tag: ${{ github.event.inputs.tag || 'develop' }}
jobs:
build-frontend:
runs-on: ubuntu-latest
name: "Build Frontend"
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.tag }}
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: Build packages
run: pnpm build:all
- working-directory: ./apps/tlon-web
run: pnpm build
- uses: actions/upload-artifact@v3
with:
name: "ui-dist"
path: apps/tlon-web/dist
build-new-frontend:
runs-on: ubuntu-latest
name: "Build New Frontend"
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.tag }}
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: Build packages
run: pnpm build:all
- working-directory: ./apps/tlon-web-new
run: pnpm build:alpha
- uses: actions/upload-artifact@v3
with:
name: "ui-dist-new"
path: apps/tlon-web-new/dist
glob:
runs-on: ubuntu-latest
name: "Make a glob"
needs: build-frontend
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.tag }}
ssh-key: ${{ secrets.DEPLOY_KEY }}
- uses: actions/download-artifact@v3
with:
name: "ui-dist"
path: apps/tlon-web/dist
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_SERVICE_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
- name: "glob"
uses: ./.github/actions/glob
with:
folder: "apps/tlon-web/dist/*"
docket: "desk/desk.docket-0"
- name: Commit and Push Glob
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git add desk/desk.docket-0
git commit -n -m "update glob: ${{ steps.glob.outputs.hash }} [skip actions]" || echo "No changes to commit"
INPUT=${{ env.tag }}
BRANCH=${INPUT:-"develop"}
git pull origin $BRANCH --rebase --autostash
git push
glob-new:
runs-on: ubuntu-latest
name: "Make a glob for new frontend"
needs: build-new-frontend
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.tag }}
ssh-key: ${{ secrets.DEPLOY_KEY }}
- uses: actions/download-artifact@v3
with:
name: "ui-dist-new"
path: apps/tlon-web-new/dist
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_SERVICE_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
- name: "glob"
uses: ./.github/actions/glob
with:
folder: "apps/tlon-web-new/dist/*"
docket: "tm-alpha-desk/desk.docket-0"
- name: Commit and Push Glob
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
git add tm-alpha-desk/desk.docket-0
git commit -n -m "update new frontend glob: ${{ steps.glob.outputs.hash }} [skip actions]" || echo "No changes to commit"
INPUT=${{ env.tag }}
BRANCH=${INPUT:-"develop"}
git pull origin $BRANCH --rebase --autostash
git push
deploy:
runs-on: ubuntu-latest
needs: glob
name: "Deploy a glob to ~wannec-dozzod-marnus (devstream)"
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.tag }}
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_SERVICE_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
- id: deploy
name: Deploy
run:
./.github/helpers/deploy.sh tloncorp/tlon-apps groups
wannec-dozzod-marnus us-central1-a mainnet-tlon-other-2d ${{ env.tag
}}
env:
SSH_SEC_KEY: ${{ secrets.GCP_SSH_SEC_KEY }}
SSH_PUB_KEY: ${{ secrets.GCP_SSH_PUB_KEY }}
URBIT_REPO_TAG: ${{ vars.URBIT_REPO_TAG }}
deploy-new:
runs-on: ubuntu-latest
needs: glob-new
name: "Deploy a new frontend glob to ~wannec-dozzod-marnus (devstream)"
steps:
- uses: actions/checkout@v3
with:
ref: ${{ env.tag }}
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_SERVICE_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
- id: deploy
name: Deploy
run:
./.github/helpers/deploy.sh tloncorp/tlon-apps tm-alpha
wannec-dozzod-marnus us-central1-a mainnet-tlon-other-2d ${{ env.tag
}}
env:
SSH_SEC_KEY: ${{ secrets.GCP_SSH_SEC_KEY }}
SSH_PUB_KEY: ${{ secrets.GCP_SSH_PUB_KEY }}
URBIT_REPO_TAG: ${{ vars.URBIT_REPO_TAG }}