parent
1a00bd8925
commit
062c917c30
68
.woodpecker/build.yml
Normal file
68
.woodpecker/build.yml
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
variables:
|
||||||
|
- &volumes
|
||||||
|
- node16_cache:/root/.npm
|
||||||
|
- /data/${CI_REPO}:/builds
|
||||||
|
|
||||||
|
when:
|
||||||
|
event: [push, pull_request, tag, manual]
|
||||||
|
branch: [master, master-*, develop, develop-*, feature/*]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
db-wait:
|
||||||
|
image: gitnet.fr/deblan/timeout:latest
|
||||||
|
commands:
|
||||||
|
- /bin/timeout -t 30 -v -c 'while true; do nc -z -v db 3306 2>&1 | grep succeeded && exit 0; sleep 0.5; done'
|
||||||
|
|
||||||
|
db-create:
|
||||||
|
image: mariadb:10.3
|
||||||
|
secrets: [mysqldump]
|
||||||
|
commands:
|
||||||
|
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
|
||||||
|
|
||||||
|
app-config:
|
||||||
|
image: deblan/php:8.1
|
||||||
|
commands:
|
||||||
|
- echo APP_ENV=prod >> .env.local
|
||||||
|
- echo APP_SECRET=$(openssl rand -hex 32) >> .env.local
|
||||||
|
- echo DATABASE_URL=mysql://root:root@db/app >> .env.local
|
||||||
|
|
||||||
|
php-composer:
|
||||||
|
image: deblan/php:8.1
|
||||||
|
commands:
|
||||||
|
- apt-get update && apt-get -y install git
|
||||||
|
- composer install --no-scripts
|
||||||
|
|
||||||
|
php-build:
|
||||||
|
image: deblan/php:8.1
|
||||||
|
environment:
|
||||||
|
- PHP=php
|
||||||
|
commands:
|
||||||
|
- ./bin/doctrine-migrate
|
||||||
|
- php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
|
||||||
|
|
||||||
|
node-build:
|
||||||
|
image: node:16-alpine
|
||||||
|
commands:
|
||||||
|
- make asset
|
||||||
|
|
||||||
|
security-check:
|
||||||
|
image: gitnet.fr/deblan/osv-detector:v0.9
|
||||||
|
commands:
|
||||||
|
- osv-detector composer.lock yarn.lock
|
||||||
|
failure: ignore
|
||||||
|
|
||||||
|
cache-build:
|
||||||
|
image: deblan/mage
|
||||||
|
volumes: *volumes
|
||||||
|
commands:
|
||||||
|
- cd /builds
|
||||||
|
- rsync -az "$CI_WORKSPACE/" "$CI_COMMIT_SHA"
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mariadb:10.3
|
||||||
|
environment:
|
||||||
|
- MARIADB_ROOT_PASSWORD=root
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
node16_cache:
|
25
.woodpecker/deploy.yml
Normal file
25
.woodpecker/deploy.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
variables:
|
||||||
|
- &volumes
|
||||||
|
- /data/deblan/deblan.io-murph:/builds
|
||||||
|
|
||||||
|
when:
|
||||||
|
event: [deployment]
|
||||||
|
|
||||||
|
skip_clone: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
app-deploy:
|
||||||
|
image: deblan/mage
|
||||||
|
secrets: [ssh_user, ssh_host, ssh_priv_key, app_directory]
|
||||||
|
volumes: *volumes
|
||||||
|
commands:
|
||||||
|
- cd "/builds/$CI_COMMIT_SHA"
|
||||||
|
- mkdir "$HOME/.ssh"
|
||||||
|
- echo "$SSH_PRIV_KEY" > "$HOME/.ssh/id_ed25519"
|
||||||
|
- chmod 700 "$HOME/.ssh"
|
||||||
|
- chmod 600 "$HOME/.ssh/id_ed25519"
|
||||||
|
- cp .mage.yml.dist .mage.yml
|
||||||
|
- sed -i "s/ssh_user/$SSH_USER/g" .mage.yml
|
||||||
|
- sed -i "s/ssh_host/$SSH_HOST/g" .mage.yml
|
||||||
|
- sed -i "s#app_directory#$APP_DIRECTORY#g" .mage.yml
|
||||||
|
- mage deploy "$CI_PIPELINE_DEPLOY_TARGET"
|
Loading…
Reference in a new issue