From c4c2553c53e52b26e32a4b3b755f730a3289a2b8 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 13 Sep 2024 13:41:10 +0300 Subject: [PATCH] add docker build ci --- .gitea/workflows/docker.yml | 78 +++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .gitea/workflows/docker.yml diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml new file mode 100644 index 0000000..73c7dcb --- /dev/null +++ b/.gitea/workflows/docker.yml @@ -0,0 +1,78 @@ +name: Docker Image CI + +on: + push: + branches: + - master + tags: + - v* + pull_request: + branches: + - master + workflow_dispatch: + +permissions: + packages: write + contents: read + +jobs: + test: + runs-on: cth-ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build image + uses: docker/build-push-action@v4 + with: + context: . + push: false + tags: gitea.b4tman.ru/${{ gitea.repository }}:test + push: + needs: test + runs-on: cth-ubuntu-latest + if: github.event_name != 'pull_request' + steps: + - uses: actions/checkout@v4 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + gitea.b4tman.ru/${{ gitea.repository }} + flavor: | + latest=${{ github.ref == 'refs/heads/master' }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to gitea + uses: docker/login-action@v3 + with: + registry: gitea.b4tman.ru + username: ${{ gitea.repository_owner }} + password: ${{ secrets.PKGS_TOKEN }} + + - name: Build and push image + uses: docker/build-push-action@v4 + with: + context: . + push: true + #platforms: linux/amd64,linux/arm64 + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}