Compare commits

...

10 commits

2 changed files with 50 additions and 24 deletions

View file

@ -4,15 +4,6 @@ labels:
steps:
- name: build
image: docker
when:
- branch: master
event: push
commands:
- docker build -t "$REGISTRY_IMAGE_TAG" .
- echo "$FORGEJO_REGISTRY_PASSWORD" | docker login "$FORGEJO_REGISTRY_URL" --password-stdin -u "$FORGEJO_REGISTRY_USERNAME"
- docker push "$REGISTRY_IMAGE_TAG"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
FORGEJO_REGISTRY_URL:
from_secret: FORGEJO_REGISTRY_URL
@ -22,3 +13,25 @@ steps:
from_secret: FORGEJO_REGISTRY_PASSWORD
REGISTRY_IMAGE_TAG:
from_secret: REGISTRY_IMAGE_TAG
commands:
- docker build -t "$REGISTRY_IMAGE_TAG" .
- echo "$FORGEJO_REGISTRY_PASSWORD" | docker login "$FORGEJO_REGISTRY_URL" --password-stdin -u "$FORGEJO_REGISTRY_USERNAME"
- docker push "$REGISTRY_IMAGE_TAG"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- name: discord
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: DISCORD_WEBHOOK_ID
webhook_token:
from_secret: DISCORD_WEBHOOK_TOKEN
message: >
{{#success build.status}}
{{repo.name}} build #{{build.number}} {{build.status}}
{{/success}}
depends_on: build
when:
- branch: master
event: push

View file

@ -1,9 +1,17 @@
steps:
- name: deploy
image: alpine:3.20
when:
- branch: master
event: push
environment:
SSH_HOST:
from_secret: SSH_HOST
PROJECT_DIRECTORY:
from_secret: PROJECT_DIRECTORY
WOODPECKER_SSH_KEY:
from_secret: WOODPECKER_SSH_KEY
REGISTRY_IMAGE_TAG:
from_secret: REGISTRY_IMAGE_TAG
DOCKER_VOLUME_DB:
from_secret: DOCKER_VOLUME_DB
commands:
- apk add openssh
- mkdir -p /root/.ssh/
@ -14,21 +22,26 @@ steps:
cd "$PROJECT_DIRECTORY";
docker-compose down;
docker image rm "$REGISTRY_IMAGE_TAG" || true;
docker volume rm "$DOCKER_DB_VOLUME" || true;
docker volume rm "$DOCKER_VOLUME_DB" || true;
docker pull "$REGISTRY_IMAGE_TAG";
docker-compose up -d;
docker image prune -af;"
environment:
SSH_HOST:
from_secret: SSH_HOST
PROJECT_DIRECTORY:
from_secret: PROJECT_DIRECTORY
WOODPECKER_SSH_KEY:
from_secret: WOODPECKER_SSH_KEY
REGISTRY_IMAGE_TAG:
from_secret: REGISTRY_IMAGE_TAG
DOCKER_DB_VOLUME:
from_secret: DOCKER_DB_VOLUME
- name: discord
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: DISCORD_WEBHOOK_ID
webhook_token:
from_secret: DISCORD_WEBHOOK_TOKEN
message: >
{{#success build.status}}
{{repo.name}} deployment #{{build.number}} {{build.status}}
{{/success}}
depends_on: deploy
when:
- branch: master
event: push
depends_on:
- build