-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (118 loc) · 4.15 KB
/
deploy-demos.yaml
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
name: Deploy demo sites
on:
workflow_dispatch:
push:
branches:
- master
concurrency: demo_environment
jobs:
# pre-deploy:
# name: 🚧 Pre deploy
# runs-on: ubuntu-latest
# outputs:
# should_skip: ${{ steps.skip_check.outputs.should_skip }}
# steps:
# - id: skip_check
# name: 🛑 Make sure only a single deployment is running
# uses: fkirc/skip-duplicate-actions@master
# with:
# concurrent_skipping: always
# cancel_others: true
# # paths_ignore: '["**/*.md"]'
deploy:
# needs: pre-deploy
# if: ${{ needs.pre-deploy.outputs.should_skip != 'true' }}
name: 🚀 Deploy demo sites
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
config: [fnf, ofcra, ofcra2, 3cb, rb, tbd, hk]
include:
- config: fnf
uname_secret: DB_USERNAME_FNF
pword_secret: DB_PASSWORD_FNF
- config: ofcra
uname_secret: DB_USERNAME_OFCRA
pword_secret: DB_PASSWORD_OFCRA
- config: ofcra2
uname_secret: DB_USERNAME_OFCRA2
pword_secret: DB_PASSWORD_OFCRA2
- config: 3cb
uname_secret: DB_USERNAME_3CB
pword_secret: DB_PASSWORD_3CB
- config: rb
uname_secret: DB_USERNAME_RB
pword_secret: DB_PASSWORD_RB
- config: tbd
uname_secret: DB_USERNAME_TBD
pword_secret: DB_PASSWORD_TBD
- config: hk
uname_secret: DB_USERNAME_HK
pword_secret: DB_PASSWORD_HK
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v4
- name: ✏️ Replace config[base_url]
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "application/config/config.php"
regex: false
find: "$config['base_url'] = 'http://localhost/';"
replace: "$config['base_url'] = 'https://${{ matrix.config }}-stats.devs.space/';"
- name: ✏️ Replace autoload[config]
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "application/config/autoload.php"
regex: false
find: "$autoload['config'] = array('localhost');"
replace: "$autoload['config'] = array('${{ matrix.config }}');"
- name: ✏️ Replace db[default][hostname]
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "application/config/database.php"
regex: false
find: "'hostname' => 'db',"
replace: "'hostname' => 'localhost',"
- name: ✏️ Replace db[default][username]
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "application/config/database.php"
regex: false
find: "'username' => 'root',"
replace: "'username' => '${{ secrets[matrix.uname_secret] }}',"
- name: ✏️ Replace db[default][password]
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "application/config/database.php"
regex: false
find: "'password' => 'rootpass',"
replace: "'password' => '${{ secrets[matrix.pword_secret] }}',"
- name: ✏️ Replace db[default][database]
uses: jacobtomlinson/gha-find-replace@v3
with:
include: "application/config/database.php"
regex: false
find: "'database' => 'ocapstats',"
replace: "'database' => '${{ secrets[matrix.uname_secret] }}',"
- name: ✏️ Replace CI_ENV
uses: jacobtomlinson/gha-find-replace@v3
with:
include: ".htaccess"
regex: false
find: "SetEnv CI_ENV development"
replace: "SetEnv CI_ENV production"
- name: 📂 Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.4
with:
server: "${{ secrets.FTP_HOSTNAME }}"
username: "${{ secrets.FTP_USERNAME }}"
password: "${{ secrets.FTP_PASSWORD }}"
server-dir: "${{ matrix.config }}-stats/"
exclude: |
**/.git*
**/.git*/**
.sql/**
.dev/**
docker-compose.yml