diff --git a/.gitea/workflows/build-and-push.yml b/.gitea/workflows/build-and-push.yml index 9af50d3..2c2abd1 100644 --- a/.gitea/workflows/build-and-push.yml +++ b/.gitea/workflows/build-and-push.yml @@ -7,45 +7,37 @@ on: tags: - "v*" -env: - REGISTRY: gitea.jeanlucmakiola.de - IMAGE_NAME: ${{ gitea.repository }} - jobs: build-and-push: - runs-on: ubuntu-latest + runs-on: dind + container: + image: docker:cli + services: + dind: + image: docker:dind + options: --privileged + env: + DOCKER_TLS_CERTDIR: "" + env: + DOCKER_HOST: tcp://dind:2375 steps: - name: Checkout uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Gitea Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ gitea.actor }} - password: ${{ secrets.GITEA_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' }} + - name: Log in to Gitea registry + run: | + REGISTRY="${{ gitea.server_url }}" + REGISTRY="${REGISTRY#https://}" + REGISTRY="${REGISTRY#http://}" + echo "${{ secrets.GITEA_TOKEN }}" | docker login "$REGISTRY" -u "${{ gitea.actor }}" --password-stdin - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + run: | + REGISTRY="${{ gitea.server_url }}" + REGISTRY="${REGISTRY#https://}" + REGISTRY="${REGISTRY#http://}" + IMAGE="$REGISTRY/${{ gitea.repository }}" + docker build -t "$IMAGE:${{ gitea.sha }}" -t "$IMAGE:latest" . + docker push "$IMAGE:${{ gitea.sha }}" + docker push "$IMAGE:latest"