-
Notifications
You must be signed in to change notification settings - Fork 3
127 lines (116 loc) · 5.13 KB
/
main.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
name: main
on:
push:
branches: [main]
env:
DOKKU_REMOTE_BRANCH: "master"
DOKKU_REMOTE_URL: "ssh://[email protected]/promise-tracker-ui"
GIT_PUSH_FLAGS: "--force"
BACKEND: "gsheet"
APP_SLUG: "sonko"
IMAGE_DOMAINS: "dashboard.hurumap.org,promisetracker.org.zw,res.cloudinary.com"
ACTNOW_URL: "https://actnow.dev.codeforafrica.org"
GSHEETS_ENTITIES_SHEET_ID: "1160397588"
GSHEETS_ARTICLES_CATEGORIES_SHEET_ID: "1120844020"
GSHEETS_FACTCHECKS_CATEGORIES_SHEET_ID: "1911965554"
GSHEETS_SITES_NAVIGATIONS_SHEET_ID: "2049055854"
GSHEETS_CATEGORIES_SHEET_ID: "1509305349"
GSHEETS_SPREADSHEET_ID: "1OHhP_0xeymHs7aX1pmbqetW1i5wz-kXX45Xr894L6HQ"
GSHEETS_PROMISES_SHEET_ID: "0"
GSHEETS_SITES_SHEET_ID: "1815808092"
GOOGLE_ID: "742298677772-neno281kelle2fqbcp935buhn5sc6msc.apps.googleusercontent.com"
GSHEETS_STATUSES_SHEET_ID: "260491438"
GSHEETS_ARTICLES_SHEET_ID: "1101723406"
GSHEETS_FACTCHECKS_SHEET_ID: "1909841950"
GSHEETS_PROMISES_CATEGORIES_SHEET_ID: "975116023"
GSHEETS_PROMISES_EVENTS_SHEET_ID: "797580123"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# Set up Node since it's required by version-check
# https://github.com/EndBug/version-check#github-workflow
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
- name: Check if version is bumped
id: version-check
uses: EndBug/version-check@v1
with:
# Whether to search in every commit's diff.
# This is useful if you often do change the version without saying it
# in the commit message. If you always include the semver of the new
# version in your commit message when you bump versions then you can
# omit this.
diff-search: true
- name: Set up Docker Buildx
if: steps.version-check.outputs.changed == 'true'
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
if: steps.version-check.outputs.changed == 'true'
uses: actions/cache@v2
with:
key: ${{ runner.os }}-buildx-${{ github.sha }}
path: /tmp/.buildx-cache
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
if: steps.version-check.outputs.changed == 'true'
uses: docker/login-action@v1
with:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
username: ${{ secrets.DOCKER_HUB_USERNAME }}
- name: Build Docker image
if: steps.version-check.outputs.changed == 'true'
uses: docker/build-push-action@v2
with:
build-args: |
BACKEND=${{ env.BACKEND }}
APP_SLUG=${{ env.APP_SLUG }}
ACTNOW_URL=${{ env.ACTNOW_URL }}
IMAGE_DOMAINS=${{ env.IMAGE_DOMAINS }}
ACTNOW_API_KEY=${{ secrets.ACTNOW_API_KEY }}
ACTNOW_CLIENT_ID=${{ secrets.ACTNOW_CLIENT_ID }}
ACTNOW_CLIENT_SECRET=${{ secrets.ACTNOW_CLIENT_SECRET }}
GOOGLE_ID=${{ env.GOOGLE_ID }}
GOOGLE_SECRET=${{ secrets.GOOGLE_SECRET }}
GSHEETS_ENTITIES_SHEET_ID=${{ env.GSHEETS_ENTITIES_SHEET_ID }}
GSHEETS_ARTICLES_CATEGORIES_SHEET_ID=${{ env.GSHEETS_ARTICLES_CATEGORIES_SHEET_ID }}
GSHEETS_FACTCHECKS_CATEGORIES_SHEET_ID=${{ env.GSHEETS_FACTCHECKS_CATEGORIES_SHEET_ID }}
GSHEETS_SITES_NAVIGATIONS_SHEET_ID=${{ env.GSHEETS_SITES_NAVIGATIONS_SHEET_ID }}
GSHEETS_CATEGORIES_SHEET_ID=${{ env.GSHEETS_CATEGORIES_SHEET_ID }}
GSHEETS_SPREADSHEET_ID=${{ env.GSHEETS_SPREADSHEET_ID }}
GSHEETS_PROMISES_SHEET_ID=${{ env.GSHEETS_PROMISES_SHEET_ID }}
GSHEETS_SITES_SHEET_ID=${{ env.GSHEETS_SITES_SHEET_ID }}
GSHEETS_STATUSES_SHEET_ID=${{ env.GSHEETS_STATUSES_SHEET_ID }}
GSHEETS_ARTICLES_SHEET_ID=${{ env.GSHEETS_ARTICLES_SHEET_ID }}
GSHEETS_FACTCHECKS_SHEET_ID=${{ env.GSHEETS_FACTCHECKS_SHEET_ID }}
GSHEETS_PROMISES_CATEGORIES_SHEET_ID=${{ env.GSHEETS_PROMISES_CATEGORIES_SHEET_ID }}
GSHEETS_PROMISES_EVENTS_SHEET_ID=${{ env.GSHEETS_PROMISES_EVENTS_SHEET_ID }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
context: .
push: true
tags: "codeforafrica/promise-tracker-ui:${{ steps.version-check.outputs.version }}"
- name: Move cache
if: steps.version-check.outputs.changed == 'true'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Push to Dokku
if: steps.version-check.outputs.changed == 'true'
uses: dokku/[email protected]
with:
branch: ${{ env.DOKKU_REMOTE_BRANCH }}
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
git_push_flags: ${{ env.GIT_PUSH_FLAGS }}
git_remote_url: ${{ env.DOKKU_REMOTE_URL }}