Merge pull request #640 from getsentry/indygreg-again-again #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: image | |
on: | |
pull_request: | |
paths: [docker/*, .github/workflows/image.yml] | |
push: | |
branches: [main, test-me-*] | |
paths: [docker/*, .github/workflows/image.yml] | |
concurrency: | |
# serialize runs on the default branch | |
group: ${{ github.event_name == 'push' && github.workflow || github.sha }}${{ github.workflow }} | |
jobs: | |
image: | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
env: | |
TARGET_TAG: ghcr.io/getsentry/pypi-manylinux-${{ matrix.arch }}-ci | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: enable cross build | |
run: docker run --rm --privileged tonistiigi/binfmt --install arm64 | |
if: matrix.arch == 'arm64' | |
- name: build | |
run: | | |
args=() | |
if docker pull -q "$TARGET_TAG"; then | |
args+=(--cache-from "$TARGET_TAG") | |
fi | |
docker buildx build \ | |
"${args[@]}" \ | |
--platform linux/${{ matrix.arch }} \ | |
--tag "${TARGET_TAG}:${GITHUB_SHA}" \ | |
docker | |
docker tag "${TARGET_TAG}:${GITHUB_SHA}" "${TARGET_TAG}:latest" | |
- name: push | |
run: | | |
docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< '${{ secrets.GITHUB_TOKEN }}' | |
docker push "${TARGET_TAG}:${GITHUB_SHA}" | |
docker push "${TARGET_TAG}:latest" | |
if: github.event_name != 'pull_request' |