mirror of
https://github.com/sigmasternchen/useful-api.org
synced 2025-03-15 07:58:55 +00:00
chore: Add deployment pipeline
This commit is contained in:
parent
b2cbb63f47
commit
6a6d0b641e
3 changed files with 44 additions and 1 deletions
40
.github/workflows/upload.yml
vendored
Normal file
40
.github/workflows/upload.yml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
name: 'Publish to prod'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload-prod:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: 'read'
|
||||||
|
id-token: 'write'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v3'
|
||||||
|
- name: Upload
|
||||||
|
env:
|
||||||
|
FTP_SERVER: ${{ secrets.FTP_SERVER }}
|
||||||
|
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
|
||||||
|
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
sudo apt install lftp
|
||||||
|
rm -rf .git .github
|
||||||
|
mv maintenance.php maintenance-real.php
|
||||||
|
sed -e 's/false/true/g' maintenance-real.php > maintenance.php
|
||||||
|
lftp -e "
|
||||||
|
set sftp:auto-confirm yes;
|
||||||
|
set ssl:verify-certificate no;
|
||||||
|
open -u ${FTP_USERNAME},${FTP_PASSWORD} sftp://${FTP_SERVER};
|
||||||
|
put maintenance.php -o maintenance.php;
|
||||||
|
mirror --exclude=maintenance-real.php -e -R ./ ./;
|
||||||
|
put maintenance-real.php -o maintenance.php;
|
||||||
|
quit;
|
||||||
|
"
|
2
core.php
2
core.php
|
@ -5,7 +5,7 @@ const ROOT = __DIR__;
|
||||||
define("MAINTENANCE_MODE", require(ROOT . "/maintenance.php"));
|
define("MAINTENANCE_MODE", require(ROOT . "/maintenance.php"));
|
||||||
|
|
||||||
if (MAINTENANCE_MODE) {
|
if (MAINTENANCE_MODE) {
|
||||||
require(ROOT . "./templates/maintenance.php");
|
require(ROOT . "/templates/maintenance.php");
|
||||||
} else {
|
} else {
|
||||||
$router = require(ROOT . "/router/Router.php");
|
$router = require(ROOT . "/router/Router.php");
|
||||||
|
|
||||||
|
|
|
@ -8,3 +8,6 @@ RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule . /index.php [L]
|
RewriteRule . /index.php [L]
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
|
php_flag log_errors on
|
||||||
|
php_value error_log /usr/home/usefula/php.log
|
Loading…
Reference in a new issue