rm deploy.yml
This commit is contained in:
parent
adbdb091d7
commit
9ef5fe9fc7
2 changed files with 18 additions and 44 deletions
|
|
@ -29,10 +29,8 @@ jobs:
|
|||
IMAGE_BASE="git.avatic.de/lcc_public/lcc"
|
||||
TAGS=""
|
||||
|
||||
# SHA tag (immer)
|
||||
TAGS="${TAGS} -t ${IMAGE_BASE}:${{ gitea.sha }}"
|
||||
|
||||
# Branch-spezifische Tags
|
||||
if [ "${{ gitea.ref_name }}" = "main" ]; then
|
||||
TAGS="${TAGS} -t ${IMAGE_BASE}:latest"
|
||||
TAGS="${TAGS} -t ${IMAGE_BASE}:main"
|
||||
|
|
@ -40,7 +38,6 @@ jobs:
|
|||
TAGS="${TAGS} -t ${IMAGE_BASE}:dev"
|
||||
fi
|
||||
|
||||
# Release-Tag (wenn es ein Tag ist)
|
||||
if [[ "${{ gitea.ref }}" == refs/tags/* ]]; then
|
||||
VERSION="${{ gitea.ref_name }}"
|
||||
TAGS="${TAGS} -t ${IMAGE_BASE}:${VERSION}"
|
||||
|
|
@ -60,10 +57,8 @@ jobs:
|
|||
run: |
|
||||
IMAGE_BASE="${{ steps.tags.outputs.image_base }}"
|
||||
|
||||
# Push SHA (immer)
|
||||
docker push ${IMAGE_BASE}:${{ gitea.sha }}
|
||||
|
||||
# Push branch-spezifische Tags
|
||||
if [ "${{ gitea.ref_name }}" = "main" ]; then
|
||||
docker push ${IMAGE_BASE}:latest
|
||||
docker push ${IMAGE_BASE}:main
|
||||
|
|
@ -71,7 +66,23 @@ jobs:
|
|||
docker push ${IMAGE_BASE}:dev
|
||||
fi
|
||||
|
||||
# Push Release-Tag (wenn vorhanden)
|
||||
if [[ "${{ gitea.ref }}" == refs/tags/* ]]; then
|
||||
docker push ${IMAGE_BASE}:${{ gitea.ref_name }}
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Deploy to Docker
|
||||
if: github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev')
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
BRANCH="${{ gitea.ref_name }}"
|
||||
DEPLOY_PATH="${{ secrets.DEPLOY_PATH }}"
|
||||
|
||||
ssh -i ~/.ssh/deploy_key ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << EOF
|
||||
cd ${DEPLOY_PATH}
|
||||
docker compose pull lcc-app-${BRANCH}
|
||||
docker compose --profile ${BRANCH} up -d lcc-app-${BRANCH}
|
||||
EOF
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
name: Deploy Docker Container
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build and Push Docker Image"]
|
||||
types:
|
||||
- completed
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.workflow_run.head_branch }}
|
||||
|
||||
- name: Deploy to Docker
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
BRANCH="${{ github.event.workflow_run.head_branch }}"
|
||||
DEPLOY_PATH="${{ secrets.DEPLOY_PATH }}"
|
||||
|
||||
ssh -i ~/.ssh/deploy_key ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << EOF
|
||||
cd ${DEPLOY_PATH}
|
||||
docker compose pull lcc-app-${BRANCH}
|
||||
docker compose --profile ${BRANCH} up -d lcc-app-${BRANCH}
|
||||
EOF
|
||||
Loading…
Add table
Reference in a new issue