Skip to content

🏦

🏦 #190

Workflow file for this run

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.5
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