Deploy-Action in eigenes öffentliches Repo deploy-action ausgelagert (Runner klont Actions anonym)
This commit is contained in:
1 parent
75c9ced16f
commit
3730d47711
2 files changed
+4
-77
No files matched your search
-74
@@ -1,74 +0,0 @@
|
||||
name: docker-deploy
|
||||
description: Synchronisiert das Repo per rsync nach ~/deployment und startet docker-deploy.sh auf dem Zielserver
|
||||
|
||||
# Verwendung (siehe examples/deploy.yml):
|
||||
# - uses: actions/checkout@v4
|
||||
# - uses: https://git.share-fix.de/jochen/admin-toolsuite@v1
|
||||
# with:
|
||||
# deploy_user: ${{ vars.deploy_user }}
|
||||
# deploy_host: ${{ vars.deploy_host }}
|
||||
# deploy_pass: ${{ secrets.deploy_pass }}
|
||||
|
||||
inputs:
|
||||
deploy_user:
|
||||
description: Deploy-User auf dem Zielserver
|
||||
required: true
|
||||
deploy_host:
|
||||
description: Hostname/IP des Zielservers
|
||||
required: true
|
||||
deploy_pass:
|
||||
description: Passwort/App-Token des Deploy-Users
|
||||
required: true
|
||||
compose_file:
|
||||
description: Compose-Datei, die vor dem Deploy validiert wird
|
||||
default: docker-compose.yml
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Compose-Datei validieren
|
||||
shell: bash
|
||||
run: docker compose -f "$COMPOSE_FILE" config --quiet
|
||||
env:
|
||||
COMPOSE_FILE: ${{ inputs.compose_file }}
|
||||
|
||||
- name: Tools installieren
|
||||
shell: bash
|
||||
run: sudo apt-get update -qq && sudo apt-get install -y -qq sshpass rsync
|
||||
|
||||
- name: Dateien nach ~/deployment synchronisieren
|
||||
shell: bash
|
||||
run: |
|
||||
sshpass -e rsync -az --delete \
|
||||
--exclude '.git' --exclude '.gitea' --exclude '.env' \
|
||||
--filter=':- .gitignore' \
|
||||
-e "ssh $SSH_OPTS" \
|
||||
./ "$DEPLOY_USER@$DEPLOY_HOST:deployment/"
|
||||
env:
|
||||
DEPLOY_USER: ${{ inputs.deploy_user }}
|
||||
DEPLOY_HOST: ${{ inputs.deploy_host }}
|
||||
SSHPASS: ${{ inputs.deploy_pass }}
|
||||
SSH_OPTS: -o StrictHostKeyChecking=accept-new -o PubkeyAuthentication=no
|
||||
|
||||
- name: Deploy (pull → build → up)
|
||||
shell: bash
|
||||
run: |
|
||||
sshpass -e ssh $SSH_OPTS "$DEPLOY_USER@$DEPLOY_HOST" \
|
||||
"sudo /usr/local/bin/docker-deploy.sh $DEPLOY_USER deploy"
|
||||
env:
|
||||
DEPLOY_USER: ${{ inputs.deploy_user }}
|
||||
DEPLOY_HOST: ${{ inputs.deploy_host }}
|
||||
SSHPASS: ${{ inputs.deploy_pass }}
|
||||
SSH_OPTS: -o StrictHostKeyChecking=accept-new -o PubkeyAuthentication=no
|
||||
|
||||
- name: Logs bei Fehler
|
||||
if: failure()
|
||||
shell: bash
|
||||
run: |
|
||||
sshpass -e ssh $SSH_OPTS "$DEPLOY_USER@$DEPLOY_HOST" \
|
||||
"sudo /usr/local/bin/docker-deploy.sh $DEPLOY_USER logs" || true
|
||||
env:
|
||||
DEPLOY_USER: ${{ inputs.deploy_user }}
|
||||
DEPLOY_HOST: ${{ inputs.deploy_host }}
|
||||
SSHPASS: ${{ inputs.deploy_pass }}
|
||||
SSH_OPTS: -o StrictHostKeyChecking=accept-new -o PubkeyAuthentication=no
|
||||
+4
-3
@@ -1,7 +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.1) wird von Renovate per PR aktualisiert (siehe renovate.json).
|
||||
# Die eigentliche Logik liegt als Composite Action im öffentlichen Repo
|
||||
# jochen/deploy-action (der Runner klont Actions anonym, daher muss es public sein).
|
||||
# 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)
|
||||
@@ -29,7 +30,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: https://git.share-fix.de/jochen/admin-toolsuite@v1.0.1
|
||||
- uses: https://git.share-fix.de/jochen/deploy-action@v1.0.0
|
||||
with:
|
||||
deploy_user: ${{ vars.deploy_user }}
|
||||
deploy_host: ${{ vars.deploy_host }}
|
||||
|
||||
Reference in new issue
Block a user