diff --git a/.github/workflows/docker-multiarch-tag.yml b/.github/workflows/docker-multiarch-tag.yml new file mode 100644 index 0000000..8cf5ffa --- /dev/null +++ b/.github/workflows/docker-multiarch-tag.yml @@ -0,0 +1,57 @@ +name: Build Multi-Arch Docker Image on Tag + +on: + push: + tags: + - "v*.*.*" + - "*.*.*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set version from tag + id: version + run: | + TAG="${{ github.ref_name }}" + # Strip leading 'v' if present (e.g. v3.4.0 -> 3.4.0) + VERSION="${TAG#v}" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: hemna6969/aprsd + tags: | + type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.ref_type == 'tag' }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./docker + file: ./docker/Dockerfile + platforms: linux/amd64,linux/arm64 + build-args: | + INSTALL_TYPE=pypi + VERSION=${{ steps.version.outputs.version }} + BUILDX_QEMU_ENV=true + push: true + provenance: false + tags: ${{ steps.meta.outputs.tags }}