From 5356730c01f4998fcbfda8b909108cda32791574 Mon Sep 17 00:00:00 2001 From: Patrick Niebeling Date: Wed, 20 Nov 2024 14:15:32 +0100 Subject: [PATCH] Upldate Signed-off-by: Patrick Niebeling --- .gitea/workflows/deploy.yaml | 56 ++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 51230a4..c886b69 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -1,31 +1,49 @@ name: Deploy Container Image to Registry on: + schedule: + - cron: 0,10,15 * * * * push: branches: - main jobs: - build-image: + docker: runs-on: ubuntu-latest steps: - - name: Check out repository code + - name: Checkout uses: actions/checkout@v4 - - name: Build Image - run: | - echo "[***] Build hook running" - cd ${{ gitea.workspace }}/StableV2/ - VERSION=$(git ls-remote --tags -q https://github.com/rspamd/rspamd | sed -n "s/^[[:xdigit:]]\{40\}[[:blank:]]refs\/tags\/\([0-9]\{1\}\.[0-9]\{1,2\}\($\|\.[0-9]\{1,2\}$\)\)/\1/p" | sort --version-sort | tail -1) - docker build \ - --build-arg VERSION=${VERSION} \ - --build-arg COMMIT=$(git ls-remote --tags -q https://github.com/rspamd/rspamd | sed -n "s/^\([[:xdigit:]]\{40\}\)[[:blank:]]refs\/tags\/${VERSION}^{}$/\1/p" | xargs git rev-parse --short) \ - --build-arg BRANCH=$(git rev-parse --abbrev-ref HEAD) \ - --build-arg DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ - -t ${{ vars.DOCKER_REPO }}/gnilebein/${{ vars.IMAGE_NAME }} -t ${{ vars.DOCKER_REPO }}/gnilebein/${{ vars.IMAGE_NAME }}:$VERSION . - - name: Push Image + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: gitea.gnilebein.de + username: ${{ gitea.repository_owner }} + password: ${{ secrets.REG_GITEA_PASSWORD }} + + - name: Get Meta + id: meta run: | - echo '${{ vars.DOCKER_AUTH_CONFIG }}' > ~/.docker/config.json - cat ~/.docker/config.json - VERSION=$(git ls-remote --tags -q https://github.com/rspamd/rspamd | sed -n "s/^[[:xdigit:]]\{40\}[[:blank:]]refs\/tags\/\([0-9]\{1\}\.[0-9]\{1,2\}\($\|\.[0-9]\{1,2\}$\)\)/\1/p" | sort --version-sort | tail -1) - docker push ${{ vars.DOCKER_REPO }}/gnilebein/${{ vars.IMAGE_NAME }} - docker push ${{ vars.DOCKER_REPO }}/gnilebein/${{ vars.IMAGE_NAME }}:${VERSION} \ No newline at end of file + echo VERSION=$(git ls-remote --tags -q https://github.com/rspamd/rspamd | sed -n "s/^[[:xdigit:]]\{40\}[[:blank:]]refs\/tags\/\([0-9]\{1\}\.[0-9]\{1,2\}\($\|\.[0-9]\{1,2\}$\)\)/\1/p" | sort --version-sort | tail -1) | tee -a $GITHUB_OUTPUT + echo IMAGE_CREATED=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | tee -a $GITHUB_OUTPUT + - run: pwd + - run: ls -lah + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./StableV2 + file: StableV2/Dockerfile + pull: false + push: true + no-cache: true + build-args: | + VERSION=${{ steps.meta.outputs.VERSION }} + IMAGE_CREATED=${{ steps.meta.outputs.IMAGE_CREATED }} + tags: | + ${{ vars.DOCKER_REPO }}/${{ gitea.repository_owner }}/${{ vars.IMAGE_NAME }} + ${{ vars.DOCKER_REPO }}/${{ gitea.repository_owner }}/${{ vars.IMAGE_NAME }}:${{ steps.meta.outputs.VERSION }} \ No newline at end of file