Migrate to Forgejo
Some checks failed
Deploy Preprod / Build and Deploy to Preprod (push) Failing after 1m43s
Some checks failed
Deploy Preprod / Build and Deploy to Preprod (push) Failing after 1m43s
This commit is contained in:
parent
9ce8135a3b
commit
c2a5bd7a85
2 changed files with 116 additions and 0 deletions
58
.forgejo/workflows/deploy-preprod.yml
Normal file
58
.forgejo/workflows/deploy-preprod.yml
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
name: Deploy Preprod
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- preprod
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
name: Build and Deploy to Preprod
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: forgejo-ci-node:latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Cache node modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Install npm dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build frontend (preprod)
|
||||||
|
run: npm run build:preprod
|
||||||
|
|
||||||
|
- name: Install composer dependencies
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd
|
||||||
|
|
||||||
|
- name: Deploy via rsync
|
||||||
|
env:
|
||||||
|
USERNAME: ${{ secrets.USERNAME }}
|
||||||
|
PASSWORD: ${{ secrets.PASSWORD }}
|
||||||
|
HOST: ${{ secrets.HOST }}
|
||||||
|
PREPROD_PATH: ${{ secrets.PREPROD_PATH }}
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
|
||||||
|
rsync_deploy() {
|
||||||
|
local src=$1
|
||||||
|
local dst=$2
|
||||||
|
local exclude=$3
|
||||||
|
cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O"
|
||||||
|
[[ -n $exclude ]] && cmd="$cmd $exclude"
|
||||||
|
cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst"
|
||||||
|
echo "Deploying $src to $dst"
|
||||||
|
eval $cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'"
|
||||||
|
rsync_deploy vendor/ "$PREPROD_PATH/vendor/"
|
||||||
|
rsync_deploy kirby/ "$PREPROD_PATH/kirby/"
|
||||||
|
rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'"
|
||||||
58
.forgejo/workflows/deploy-prod.yml
Normal file
58
.forgejo/workflows/deploy-prod.yml
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
name: Deploy Production
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
name: Build and Deploy to Production
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: forgejo-ci-node:latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Cache node modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Install npm dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build frontend (production)
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Install composer dependencies
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd
|
||||||
|
|
||||||
|
- name: Deploy via rsync
|
||||||
|
env:
|
||||||
|
USERNAME: ${{ secrets.USERNAME }}
|
||||||
|
PASSWORD: ${{ secrets.PASSWORD }}
|
||||||
|
HOST: ${{ secrets.HOST }}
|
||||||
|
PROD_PATH: ${{ secrets.PROD_PATH }}
|
||||||
|
run: |
|
||||||
|
cd dist
|
||||||
|
|
||||||
|
rsync_deploy() {
|
||||||
|
local src=$1
|
||||||
|
local dst=$2
|
||||||
|
local exclude=$3
|
||||||
|
cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O"
|
||||||
|
[[ -n $exclude ]] && cmd="$cmd $exclude"
|
||||||
|
cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst"
|
||||||
|
echo "Deploying $src to $dst"
|
||||||
|
eval $cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
rsync_deploy site/ "$PROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'"
|
||||||
|
rsync_deploy vendor/ "$PROD_PATH/vendor/"
|
||||||
|
rsync_deploy kirby/ "$PROD_PATH/kirby/"
|
||||||
|
rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue