Composite Action docker-deploy im Repo-Root; Beispiel-Workflow nutzt sie, plus Renovate-Beispiele
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bd38c1ea29
commit
a1c2cbd865
4 files changed
+114
-31
No files matched your search
+8
-31
@@ -1,5 +1,8 @@
|
||||
# Beispiel: .gitea/workflows/deploy.yml im Repo eines Dienstes
|
||||
#
|
||||
# Die eigentliche Logik liegt als Composite Action in diesem Repo (action.yml).
|
||||
# Die Version (@v1.0.0) wird von Renovate per PR aktualisiert (siehe renovate.json).
|
||||
#
|
||||
# Voraussetzungen (Setup mit create-deploy-user.py --project-path owner/repo):
|
||||
# Variable deploy_user - Deploy-User (wird vom Skript gesetzt)
|
||||
# Secret deploy_pass - Passwort/App-Token des Users (wird vom Skript gesetzt)
|
||||
@@ -19,39 +22,13 @@ concurrency:
|
||||
group: deploy-${{ gitea.repository }}
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
DEPLOY_USER: ${{ vars.deploy_user }}
|
||||
DEPLOY_HOST: ${{ vars.deploy_host }}
|
||||
SSHPASS: ${{ secrets.deploy_pass }}
|
||||
SSH_OPTS: -o StrictHostKeyChecking=accept-new -o PubkeyAuthentication=no
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Compose-Datei validieren
|
||||
run: docker compose -f docker-compose.yml config --quiet
|
||||
|
||||
- name: Tools installieren
|
||||
run: sudo apt-get update -qq && sudo apt-get install -y -qq sshpass rsync
|
||||
|
||||
- name: Dateien nach ~/deployment synchronisieren
|
||||
run: |
|
||||
sshpass -e rsync -az --delete \
|
||||
--exclude '.git' --exclude '.gitea' --exclude '.env' \
|
||||
--filter=':- .gitignore' \
|
||||
-e "ssh $SSH_OPTS" \
|
||||
./ "$DEPLOY_USER@$DEPLOY_HOST:deployment/"
|
||||
|
||||
- name: Deploy (pull → build → up)
|
||||
run: |
|
||||
sshpass -e ssh $SSH_OPTS "$DEPLOY_USER@$DEPLOY_HOST" \
|
||||
"sudo /usr/local/bin/docker-deploy.sh $DEPLOY_USER deploy"
|
||||
|
||||
- name: Logs bei Fehler
|
||||
if: failure()
|
||||
run: |
|
||||
sshpass -e ssh $SSH_OPTS "$DEPLOY_USER@$DEPLOY_HOST" \
|
||||
"sudo /usr/local/bin/docker-deploy.sh $DEPLOY_USER logs" || true
|
||||
- uses: https://git.share-fix.de/jochen/admin-toolsuite@v1.0.0
|
||||
with:
|
||||
deploy_user: ${{ vars.deploy_user }}
|
||||
deploy_host: ${{ vars.deploy_host }}
|
||||
deploy_pass: ${{ secrets.deploy_pass }}
|
||||
Reference in new issue
Block a user