diff --git a/.woodpecker.yml b/.woodpecker.yml index 8aa8e54..09ee63b 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,12 +1,17 @@ variables: - &volumes - node16_cache:/root/.npm + - node16_cache:/root/.npm + - /data/deblan/deblan.io-murph:/data/deblan/deblan.io-murph pipeline: 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' + when: + event: [push, pull_request, tag, manual] + branch: [master, master-*, develop, develop-*, feature/*] db-create: image: mariadb:10.3 @@ -15,7 +20,8 @@ pipeline: - mysql -hdb -uroot -proot -e "CREATE DATABASE app" - eval "$MYSQLDUMP" | mysql -hdb -uroot -proot app when: - branch: [master, master-*, develop, develop-*] + event: [push, pull_request, tag, manual] + branch: [master, master-*, develop, develop-*, feature/*] app-config: image: deblan/php:8.1 @@ -24,13 +30,17 @@ pipeline: - echo APP_SECRET=$(openssl rand -hex 32) >> .env.local - echo DATABASE_URL=mysql://root:root@db/app >> .env.local when: - branch: [master, master-*, develop, develop-*] + event: [push, pull_request, tag, manual] + 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 + when: + event: [push, pull_request, tag, manual] + branch: [master, master-*, develop, develop-*, feature/*] db-migrate: image: deblan/php:8.1 @@ -39,6 +49,7 @@ pipeline: commands: - ./bin/doctrine-migrate when: + event: [push, pull_request, tag, manual] branch: [master, master-*, develop, develop-*, feature/*] app-jsroutes: @@ -46,6 +57,7 @@ pipeline: commands: - php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json when: + event: [push, pull_request, tag, manual] branch: [master, master-*, develop, develop-*, feature/*] node-build: @@ -62,18 +74,36 @@ pipeline: - yarn - test -f public/js/fos_js_routes.json || echo "{}" > public/js/fos_js_routes.json - npm run build + when: + event: [push, pull_request, tag, manual] + branch: [master, master-*, develop, develop-*, feature/*] security-check: image: gitnet.fr/deblan/osv-detector:v0.9 commands: - osv-detector composer.lock yarn.lock failure: ignore + when: + event: [push, pull_request, tag, manual] + branch: [master, master-*, develop, develop-*, feature/*] + + cache-build: + image: deblan/php:8.1 + volumes: *volumes + commands: + - cd /data/deblan/deblan.io-murph/ + - mv "$CI_WORKSPACE" "$CI_COMMIT_SHA" + when: + event: [push, pull_request, tag, manual] + branch: [master, master-*, develop, develop-*, feature/*] app-deploy: image: deblan/php:8.1 secrets: [ssh_user, ssh_host, ssh_priv_key, app_directory] + volumes: *volumes commands: - apt-get update && apt-get -y install rsync openssh-client + - cd "/data/deblan/deblan.io-murph/$CI_COMMIT_SHA" - mkdir "$HOME/.ssh" - echo "$SSH_PRIV_KEY" > "$HOME/.ssh/id_ed25519" - chmod 700 "$HOME/.ssh" @@ -95,4 +125,3 @@ services: volumes: node16_cache: - temp: {}