This repository has been archived by the owner on Feb 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (95 loc) · 3.92 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
name: Deploy
on:
schedule:
- cron: '0 08 * * THU'
workflow_dispatch:
inputs:
environment:
description: 'Choose an environment to deploy to: <production|test>'
required: true
default: 'test'
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v2
- id: 'get_data_tools'
name: Get tools list from Google Sheets
uses: jroehl/gsheet.action@v1.1.0
with:
spreadsheetId: 1VGVFXtfOAhZqPdY30mrD_4towCj6lCdhuwr35vp4xgM
commands: | # list of commands, specified as a valid JSON string
[
{
"command": "getData",
"args": {
"range": "'All Tools'!A:L",
"hasHeaderRow": true
}
}
]
env:
GSHEET_CLIENT_EMAIL: ${{ secrets.GSHEET_CLIENT_EMAIL }}
GSHEET_PRIVATE_KEY: ${{ secrets.GSHEET_PRIVATE_KEY }}
- name: Write tools to JSON file
env:
RESULTS: ${{ steps.get_data_tools.outputs.results }}
run: echo "$RESULTS" > tools.json
- id: 'get_data_beta'
name: Get beta list from Google Sheets
uses: jroehl/gsheet.action@v1.1.0
with:
spreadsheetId: 10SJbUuMWgc-ACOzNydXL16vE_fDwJIP92G4_L8XUhrQ
commands: | # list of commands, specified as a valid JSON string
[
{
"command": "getData",
"args": {
"range": "'All Programs'!A:M",
"hasHeaderRow": true
}
}
]
env:
GSHEET_CLIENT_EMAIL: ${{ secrets.GSHEET_CLIENT_EMAIL }}
GSHEET_PRIVATE_KEY: ${{ secrets.GSHEET_PRIVATE_KEY }}
- name: Write betas to JSON file
env:
RESULTS: ${{ steps.get_data_beta.outputs.results }}
run: echo "$RESULTS" > betas.json
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
- name: Install pip dependencies
shell: bash
run: |
pip install --upgrade pip
pip install -r requirements.txt
- name: Build static HTML
run: |
python3 build_html.py \
--tools-json tools.json \
--beta-json betas.json \
--template index.html \
--output public/index.html
- uses: actions/upload-artifact@v2
with:
name: index-html
path: public/index.html
# If this is the automated build then deploy to prod
# otherwise deploy to wherever is specified
- name: Deploy to Cloudflare (cron)
uses: cloudflare/wrangler-action@1.3.0
if: github.event_name == 'schedule'
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
environment: production
- name: Deploy to Cloudflare (environment input)
uses: cloudflare/wrangler-action@1.3.0
if: github.event_name != 'schedule'
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
environment: ${{ github.event.inputs.environment }}