publish-docker.yaml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. name: Docker Release Publish (multi-arch)
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. version:
  6. description: "RackPeek version (e.g. v1.0.0)"
  7. required: true
  8. default: "v0.0.12"
  9. permissions:
  10. contents: read
  11. jobs:
  12. docker:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v4
  17. # Multi-arch support
  18. - name: Set up QEMU
  19. uses: docker/setup-qemu-action@v3
  20. - name: Set up Docker Buildx
  21. uses: docker/setup-buildx-action@v3
  22. - name: Login to Docker Hub
  23. uses: docker/login-action@v3
  24. with:
  25. username: ${{ secrets.DOCKERHUB_USERNAME }}
  26. password: ${{ secrets.DOCKERHUB_TOKEN }}
  27. - name: Validate version input
  28. run: |
  29. VERSION="${{ github.event.inputs.version }}"
  30. echo "VERSION=$VERSION" >> $GITHUB_ENV
  31. # Require v-prefixed semver like v1.2.3
  32. if ! echo "$VERSION" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
  33. echo "Invalid version: $VERSION"
  34. echo "Expected format: vMAJOR.MINOR.PATCH (e.g. v1.0.0)"
  35. exit 1
  36. fi
  37. - name: Build and push release image (multi-arch)
  38. uses: docker/build-push-action@v5
  39. env:
  40. BUILDKIT_PROGRESS: plain
  41. with:
  42. context: .
  43. file: ./RackPeek.Web/Dockerfile
  44. platforms: linux/amd64,linux/arm64
  45. push: true
  46. target: final
  47. tags: |
  48. aptacode/rackpeek:${{ env.VERSION }}
  49. aptacode/rackpeek:latest
  50. cache-from: type=gha
  51. cache-to: type=gha,mode=max