From 2a7187cd8a9011aff34e07975c4819433ac907fa Mon Sep 17 00:00:00 2001 From: Harry Esses Date: Sun, 5 Jul 2026 18:51:45 +0000 Subject: [PATCH] Add .gitea/workflows/image-publish.yml --- .gitea/workflows/image-publish.yml | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .gitea/workflows/image-publish.yml diff --git a/.gitea/workflows/image-publish.yml b/.gitea/workflows/image-publish.yml new file mode 100644 index 0000000..32159a6 --- /dev/null +++ b/.gitea/workflows/image-publish.yml @@ -0,0 +1,56 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - master + +jobs: + docker: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Generate tags + id: vars + run: | + echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + echo "BUILD_DATE=$(date -u +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV + + - name: Login to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: git.harryesses.com + username: ${{ gitea.repository_owner }} + password: ${{ secrets.PACKAGE_TOKEN }} + + - name: Set image name + run: | + IMAGE_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') + echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV + + - name: Build Docker image + run: | + docker build \ + -t git.harryesses.com/${IMAGE_NAME}:latest \ + -t git.harryesses.com/${IMAGE_NAME}:${SHORT_SHA} \ + -t git.harryesses.com/${IMAGE_NAME}:${BUILD_DATE} \ + . + + - name: Push latest tag + run: | + docker push git.harryesses.com/${IMAGE_NAME}:latest + + - name: Push commit hash tag + run: | + docker push git.harryesses.com/${IMAGE_NAME}:${SHORT_SHA} + + - name: Push datetime tag + run: | + docker push git.harryesses.com/${IMAGE_NAME}:${BUILD_DATE} \ No newline at end of file