deblan.io-murph/.woodpecker.yml

136 lines
4.1 KiB
YAML
Raw Normal View History

2023-04-17 13:53:19 +02:00
variables:
- &volumes
2023-04-17 13:57:19 +02:00
- node16_cache:/root/.npm
2023-09-13 20:50:20 +02:00
- node16_cache:/root/.npm
- /data/deblan/deblan.io-murph:/data/deblan/deblan.io-murph
2023-04-17 13:53:19 +02:00
2022-12-28 12:59:13 +01:00
pipeline:
2023-09-13 20:55:40 +02:00
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'
2023-09-13 21:10:18 +02:00
when:
event: [push, pull_request, tag, manual]
branch: [master, master-*, develop, develop-*, feature/*]
2023-09-13 20:55:40 +02:00
db-create:
image: mariadb:10.3
secrets: [mysqldump]
commands:
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
- eval "$MYSQLDUMP" | mysql -hdb -uroot -proot app
when:
2023-09-13 21:10:18 +02:00
event: [push, pull_request, tag, manual]
2023-09-13 20:57:58 +02:00
branch: [master, master-*, develop, develop-*, feature/*]
2023-09-13 20:55:40 +02:00
2023-09-13 20:51:41 +02:00
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
2023-09-13 20:55:40 +02:00
when:
2023-09-13 21:10:18 +02:00
event: [push, pull_request, tag, manual]
2023-09-13 20:55:40 +02:00
branch: [master, master-*, develop, develop-*, feature/*]
php-composer:
image: deblan/php:8.1
commands:
- apt-get update && apt-get -y install git
- composer install --no-scripts
2023-09-13 21:10:18 +02:00
event: [push, pull_request, tag, manual]
branch: [master, master-*, develop, develop-*, feature/*]
2023-09-13 20:55:40 +02:00
db-migrate:
image: deblan/php:8.1
environment:
- PHP=php
commands:
- ./bin/doctrine-migrate
when:
2023-09-13 21:10:18 +02:00
event: [push, pull_request, tag, manual]
2023-09-13 20:55:40 +02:00
branch: [master, master-*, develop, develop-*, feature/*]
app-jsroutes:
image: deblan/php:8.1
commands:
- php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
when:
2023-09-13 21:10:18 +02:00
event: [push, pull_request, tag, manual]
2023-09-13 20:55:40 +02:00
branch: [master, master-*, develop, develop-*, feature/*]
node-build:
image: node:16-alpine
environment:
- CPU_COUNT=3
volumes: *volumes
commands:
- apk add --no-cache git
- npm install -g svg2ttf ttf2eot ttf2woff2
- svg2ttf assets/fonts/deblan/src/deblan-icon.svg assets/fonts/deblan/deblan-icon.ttf
- cat assets/fonts/deblan/deblan-icon.ttf | ttf2woff2 > assets/fonts/deblan/deblan-icon.woff2
- ttf2eot assets/fonts/deblan/deblan-icon.ttf assets/fonts/deblan/deblan-icon.eot
- yarn
- test -f public/js/fos_js_routes.json || echo "{}" > public/js/fos_js_routes.json
- npm run build
2023-09-13 20:57:58 +02:00
when:
2023-09-13 21:10:18 +02:00
event: [push, pull_request, tag, manual]
2023-09-13 20:57:58 +02:00
branch: [master, master-*, develop, develop-*, feature/*]
2023-09-13 20:55:40 +02:00
security-check:
image: gitnet.fr/deblan/osv-detector:v0.9
commands:
- osv-detector composer.lock yarn.lock
failure: ignore
2023-09-13 20:57:58 +02:00
when:
2023-09-13 21:10:18 +02:00
event: [push, pull_request, tag, manual]
2023-09-13 20:57:58 +02:00
branch: [master, master-*, develop, develop-*, feature/*]
2022-12-28 15:24:57 +01:00
2023-09-13 21:10:18 +02:00
cache-build:
2022-12-28 16:11:40 +01:00
image: deblan/php:8.1
2023-09-13 20:50:20 +02:00
volumes: *volumes
2022-12-28 16:11:40 +01:00
commands:
2023-09-13 20:50:20 +02:00
- cd /data/deblan/deblan.io-murph/
- mv "$CI_WORKSPACE" "$CI_COMMIT_SHA"
2022-12-28 17:40:10 +01:00
when:
2023-09-13 21:10:18 +02:00
event: [push, pull_request, tag, manual]
2022-12-30 17:37:10 +01:00
branch: [master, master-*, develop, develop-*, feature/*]
2022-12-28 16:11:40 +01:00
2023-01-15 15:58:15 +01:00
app-deploy:
2022-12-28 16:11:40 +01:00
image: deblan/php:8.1
secrets: [ssh_user, ssh_host, ssh_priv_key, app_directory]
commands:
2022-12-28 17:04:13 +01:00
- apt-get update && apt-get -y install rsync openssh-client
2023-09-13 20:55:40 +02:00
- cd "/data/deblan/deblan.io-murph/$CI_WORKSPACE"
2022-12-28 16:11:40 +01:00
- mkdir "$HOME/.ssh"
- echo "$SSH_PRIV_KEY" > "$HOME/.ssh/id_ed25519"
- chmod 700 "$HOME/.ssh"
- chmod 600 "$HOME/.ssh/id_ed25519"
- composer global require andres-montanez/magallanes
- 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
- /root/.config/composer/vendor/bin/mage deploy "$CI_BUILD_DEPLOY_TARGET"
when:
2022-12-28 16:51:33 +01:00
event: [deployment]
2022-12-28 13:44:31 +01:00
2023-09-13 21:10:18 +02:00
cache-clean:
image: deblan/php:8.1
volumes: *volumes
commands:
- cd /data/deblan/deblan.io-murph/
- rm * -frv
when:
event: cron
cron: cache-clean
2022-12-28 16:11:40 +01:00
services:
db:
image: mariadb:10.3
environment:
- MARIADB_ROOT_PASSWORD=root
2023-04-17 13:53:19 +02:00
volumes:
2023-04-17 13:57:19 +02:00
node16_cache: