π€¦πΏββοΈ #129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | |
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 | |
steps: | |
- name: π Get latest code | |
uses: actions/checkout@v3 | |
- 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@4.3.3 | |
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 |