forked from flotiq/gatsby-starter-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (50 loc) · 1.93 KB
/
ci.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
name: CI
# Controls when the action will run. Triggers the workflow on push
# events but only for the master branch
on:
push:
branches: [ master ]
workflow_dispatch:
repository_dispatch:
jobs:
build:
runs-on: ubuntu-latest # The type of runner that the job will run on
steps: # Steps represent a sequence of tasks that will be executed as part of the job
- uses: actions/checkout@v2 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Enter data to .env file
run: |
echo GA_TRACKING_ID="$GA_TRACKING_ID" >> .env.production
echo GATSBY_FLOTIQ_API_KEY="$GATSBY_FLOTIQ_API_KEY" >> .env.production
shell: bash
env:
GATSBY_FLOTIQ_API_KEY: ${{ secrets.GATSBY_FLOTIQ_API_KEY }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
- uses: actions/setup-node@v1
with:
node-version: '14'
- run: yarn install
- name: Gatsby
run: |
npm install -g gatsby-cli
gatsby clean
gatsby build
- name: Cloudflare
run: |
npm install -g @cloudflare/wrangler
wrangler init --site ua-drivers-faq
sed -i 's+account_id = '\'\''+account_id = '"'"$ACCOUNT_ID"'"'+g' wrangler.toml
sed -i 's+bucket = ""+bucket = "public"+g' wrangler.toml
sed -i 's+zone_id = '\'\''+zone_id = '"'"$ZONE_ID"'"'+g' wrangler.toml
sed -i 's+workers_dev = true++g' wrangler.toml
echo "[env.production]" >> wrangler.toml
echo "route = 'ua.flotiq.com/*'" >> wrangler.toml
echo 'zone_id = '"'"$ZONE_ID"'" >> wrangler.toml
mkdir -p /home/runner/.wrangler/config/
echo api_token = '"'"$API_TOKEN"'"' > /home/runner/.wrangler/config/default.toml
cat wrangler.toml
wrangler publish --env=production
shell: bash
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
ZONE_ID: ${{ secrets.ZONE_ID }}