2023-02-21 11:45:44 +00:00
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: debug
|
|
|
|
image: alpine
|
|
|
|
environment:
|
|
|
|
|
|
|
|
commands:
|
|
|
|
- 'echo "Repository: glenux/service-forgejo"'
|
|
|
|
- 'echo "Git commit: ${DRONE_COMMIT_SHA:0:8}"'
|
|
|
|
|
|
|
|
- name: publish:commit_sha
|
|
|
|
image: plugins/docker
|
|
|
|
# pull: never
|
|
|
|
# volumes:
|
|
|
|
# - name: cache
|
|
|
|
# path: /stupid
|
|
|
|
environment:
|
|
|
|
DOCKER_REPO: glenux/service-forgejo
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: DOCKERHUB_USERNAME
|
|
|
|
password:
|
|
|
|
from_secret: DOCKERHUB_PASSWORD
|
|
|
|
cache_from: "glenux/service-forgejo:latest_${DRONE_BRANCH/\\//-}"
|
|
|
|
repo: glenux/service-forgejo
|
|
|
|
tags: "${DRONE_COMMIT_SHA:0:8}"
|
|
|
|
purge: false
|
|
|
|
|
|
|
|
- name: publish:commit_branch
|
|
|
|
image: plugins/docker
|
|
|
|
# volumes:
|
|
|
|
# - name: cache
|
|
|
|
# path: /stupid
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: DOCKERHUB_USERNAME
|
|
|
|
password:
|
|
|
|
from_secret: DOCKERHUB_PASSWORD
|
|
|
|
cache_from: "glenux/service-forgejo:latest_${DRONE_BRANCH/\\//-}"
|
|
|
|
repo: glenux/service-forgejo
|
|
|
|
tags: "latest_${DRONE_BRANCH/\\//-}"
|
|
|
|
purge: false
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- "master"
|
|
|
|
- "develop"
|
|
|
|
- "feature/*"
|
|
|
|
|
|
|
|
- name: publish:latest
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: DOCKERHUB_USERNAME
|
|
|
|
password:
|
|
|
|
from_secret: DOCKERHUB_PASSWORD
|
|
|
|
cache_from: "glenux/service-forgejo:latest_${DRONE_BRANCH/\\//-}"
|
|
|
|
repo: glenux/service-forgejo
|
|
|
|
tags: latest
|
2024-03-07 19:54:15 +00:00
|
|
|
force_tag: true
|
2023-02-21 11:45:44 +00:00
|
|
|
purge: false
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- master
|
|
|
|
|
2023-02-21 11:53:24 +00:00
|
|
|
- name: deploy:dokku
|
|
|
|
image: alpine
|
2023-02-21 12:27:10 +00:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- master
|
2023-02-21 11:53:24 +00:00
|
|
|
environment:
|
|
|
|
SSH_USER:
|
|
|
|
from_secret: SSH_USER
|
|
|
|
SSH_HOST:
|
|
|
|
from_secret: SSH_HOST
|
|
|
|
SSH_PRIVATE_KEY:
|
|
|
|
from_secret: SSH_PRIVATE_KEY
|
|
|
|
commands:
|
2023-02-21 12:13:57 +00:00
|
|
|
- echo $SSH_USER
|
|
|
|
- echo $SSH_HOST
|
|
|
|
- echo $SSH_PRIVATE_KEY
|
2023-02-21 12:09:02 +00:00
|
|
|
- apk update && apk add openssh-client
|
2023-02-21 12:01:48 +00:00
|
|
|
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
2023-02-21 12:17:38 +00:00
|
|
|
- echo "$SSH_PRIVATE_KEY" | base64 -d > ~/.ssh/deploy_key
|
2023-02-21 11:57:55 +00:00
|
|
|
- chmod 600 ~/.ssh/deploy_key
|
2024-04-27 18:34:30 +00:00
|
|
|
- |
|
|
|
|
ssh -o StrictHostKeyChecking=no \
|
|
|
|
-i ~/.ssh/deploy_key \
|
|
|
|
"$SSH_USER@$SSH_HOST" \
|
2024-04-27 18:59:08 +00:00
|
|
|
git:from-image code \
|
|
|
|
"glenux/service-forgejo:${DRONE_COMMIT_SHA:0:8}"
|
2023-02-21 12:35:46 +00:00
|
|
|
- |
|
|
|
|
ssh -o StrictHostKeyChecking=no \
|
|
|
|
-i ~/.ssh/deploy_key \
|
|
|
|
"$SSH_USER@$SSH_HOST" \
|
2024-04-27 18:59:08 +00:00
|
|
|
ps:stop code
|
2023-02-21 11:53:24 +00:00
|
|
|
|
2023-02-21 11:45:44 +00:00
|
|
|
# volumes:
|
|
|
|
# - name: cache
|
|
|
|
# temp: {}
|
|
|
|
#
|