From 02422a42a8355a2da96eafe795a62b651f8ab2c4 Mon Sep 17 00:00:00 2001 From: Sergey Besedin Date: Thu, 8 Jan 2026 20:50:35 +0400 Subject: [PATCH] Build my own ansible image --- .gitea/workflows/build.yml | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..08f3ce2 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,42 @@ +name: Build and push docker image + +on: + push: + branches: master + +concurrency: + group: "${{ gitea.workflow }}-${{ gitea.repository }}" + cancel-in-progress: true + +jobs: + build: + if: gitea.event.pull_request.draft == false + runs-on: ubuntu-latest + env: + DOCKER_REGISTRY: git.aww.cloud + DOCKER_IMAGE: git.aww.cloud/${{ gitea.repository }} + steps: + - name: Login to Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} + + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Build Docker Image + run: | + # Build the image with the commit hash tag + docker build --build-arg BUILD_IDENTIFIER=${{ gitea.sha }} -t ${{ env.DOCKER_IMAGE }}:${{ gitea.sha }} . + docker tag ${{ env.DOCKER_IMAGE }}:${{ gitea.sha }} ${{ env.DOCKER_IMAGE }}:latest + + - name: Push Docker Images + run: | + docker push ${{ env.DOCKER_IMAGE }}:${{ gitea.sha }} + docker push ${{ env.DOCKER_IMAGE }}:latest + + - name: Log out from registry + if: always() + run: docker logout ${{ env.DOCKER_REGISTRY }}