All checks were successful
Create Release PR / Create Release PR (push) Successful in 20s
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: Deploy on Release
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
REGISTRY: git.tdpi.dev
|
|
IMAGE: git.tdpi.dev/tdpi/Dockhand_Backup
|
|
REPO_SLUG: TDPI/Dockhand_Backup
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Build + Push to Packages + Deploy to Prod
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set image tag
|
|
id: vars
|
|
run: |
|
|
# Tag-Name direkt aus dem Release-Event (z.B. v1.2.3)
|
|
TAG="${{ gitea.event.release.tag_name }}"
|
|
echo "TAG=$TAG" >> "$GITHUB_ENV"
|
|
|
|
- name: Login to Gitea Packages
|
|
run: |
|
|
echo "${{ secrets.GT_TOKEN }}" | docker login ${REGISTRY} -u ${{ gitea.actor }} --password-stdin
|
|
|
|
- name: Build Image
|
|
run: |
|
|
# Dockerfile liegt in docker/, Build-Context ist das Repo-Root.
|
|
docker build -f docker/Dockerfile -t ${IMAGE}:${TAG} .
|
|
docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
|
|
|
|
- name: Update docker-compose.yml tag
|
|
env:
|
|
GIT_TOKEN: ${{ secrets.GT_TOKEN }}
|
|
run: |
|
|
sed -i "s|image: ${IMAGE}:.*|image: ${IMAGE}:${TAG}|" docker-compose.yml
|
|
git config user.name "Gitea Actions"
|
|
git config user.email "actions@git.tdpi.dev"
|
|
git add docker-compose.yml
|
|
git commit -m "chore: update docker-compose tag to ${TAG}" || echo "no changes to commit"
|
|
git push https://x-access-token:${GIT_TOKEN}@${REGISTRY}/${REPO_SLUG}.git HEAD:main
|
|
|
|
- name: Push Image
|
|
run: |
|
|
docker push ${IMAGE}:${TAG}
|
|
docker push ${IMAGE}:latest
|