# build:3 labels: location: manager clone: git: image: woodpeckerci/plugin-git settings: partial: false depth: 1 when: branch: [main, production] steps: # Build Step for staging Branch build-staging: name: build-staging image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "Building application for staging branch" - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us - echo compose build - docker compose -f docker-compose.staging.yml pull --ignore-buildable - docker compose -f docker-compose.staging.yml build --pull when: event: push deploy-new: name: deploy-new image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us - echo compose push - docker compose -f docker-compose.staging.yml push - docker stack deploy --with-registry-auth -c ./stack.staging.yml $${CI_REPO_NAME}-staging when: event: push cleanup-staging: name: cleanup-staging image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - for i in {1..5}; do docker stack rm ${CI_REPO_NAME}-staging && break || sleep 10; done - docker compose -f docker-compose.staging.yml down - docker compose -f docker-compose.staging.yml rm -f when: event: push build-push-production: name: build-push-production image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "Building application for production branch" - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us - echo compose build - docker compose -f docker-compose.production.yml pull --ignore-buildable - docker compose -f docker-compose.production.yml build --pull - docker compose -f docker-compose.production.yml push when: branch: main event: push deploy-production: name: deploy-production image: woodpeckerci/plugin-docker-buildx environment: REGISTRY_USER: from_secret: REGISTRY_USER REGISTRY_PASSWORD: from_secret: REGISTRY_PASSWORD volumes: - /var/run/docker.sock:/var/run/docker.sock commands: - echo "$${REGISTRY_PASSWORD}" | docker login -u "$${REGISTRY_USER}" --password-stdin git.nixc.us - docker stack deploy --with-registry-auth -c ./stack.production.yml $${CI_REPO_NAME} when: branch: main event: push post-deploy-smoke-tests-git-nixc-us: name: run-post-deploy-smoke-tests-git-nixc-us image: git.nixc.us/colin/playwright:latest environment: BASE_URL: "https://git.nixc.us" when: branch: production event: push