diff --git a/.gitea/workflows/cd.yaml b/.gitea/workflows/cd.yaml new file mode 100644 index 0000000..f3fa322 --- /dev/null +++ b/.gitea/workflows/cd.yaml @@ -0,0 +1,86 @@ +name: Build and Release Docker Image + +on: + push: + branches: + - v2 + +jobs: + build_amd64: + name: Build and Push amd64 + runs-on: [ubuntu-latest, linux_amd64] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to registry + uses: docker/login-action@v3 + with: + registry: gitea.t000-n.de + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build Docker image for amd64 + run: | + docker build \ + --platform linux/amd64 \ + -f Dockerfile \ + -t gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-amd64 \ + . + + - name: Push Docker image for amd64 + run: | + docker push gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-amd64 + + build_arm64: + name: Build and Push arm64 + runs-on: [ubuntu-latest, linux_arm64] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to registry + uses: docker/login-action@v3 + with: + registry: gitea.t000-n.de + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build Docker image for arm64 + run: | + docker build \ + --platform linux/arm64 \ + -f Dockerfile \ + -t gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-arm64 \ + . + + - name: Push Docker image for arm64 + run: | + docker push gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-arm64 + + manifest: + name: Create and Push Multi-Arch Manifest + needs: [build_amd64, build_arm64] + runs-on: ubuntu-latest + steps: + - name: Log in to registry + uses: docker/login-action@v3 + with: + registry: gitea.t000-n.de + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Create and push manifest with git SHA + run: | + docker manifest create gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }} \ + gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-amd64 \ + gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-arm64 + docker manifest push gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }} + + - name: Optionally tag manifest as latest + if: ${{ inputs.latest == true }} + run: | + docker manifest create gitea.t000-n.de/t.behrendt/backupsidecar:latest \ + gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-amd64 \ + gitea.t000-n.de/t.behrendt/backupsidecar:${{ github.sha }}-arm64 + docker manifest push gitea.t000-n.de/t.behrendt/backupsidecar:latest