Skip to content

draft: Testing composite action #4934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
69 changes: 20 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -451,42 +451,25 @@ jobs:

env:
PLATFORMS: "${{ join(fromJson(needs.build-setup.outputs.platforms), ',') }}"
DOCKER_IMAGE: "ghcr.io/getsentry/${{ matrix.image_name }}"
REVISION: "${{ github.event.pull_request.head.sha || github.sha }}"

steps:
- uses: actions/checkout@v4

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

- uses: actions/download-artifact@v4
with:
pattern: "${{ matrix.image_name }}@*"
merge-multiple: true

- name: Build and push to ghcr.io
if: "!github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]'"
run: |
docker login --username '${{ github.actor }}' --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io

docker buildx build \
--platform "${PLATFORMS}" \
--tag "${DOCKER_IMAGE}:${REVISION}" \
$( [[ "${IS_MASTER}" == "true" ]] && printf %s "--tag ${DOCKER_IMAGE}:nightly" ) \
--file Dockerfile.release \
--push \
.

- name: Build and publish docker artifact
if: "github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]'"
run: |
docker buildx build \
--platform "${PLATFORMS}" \
--tag "${DOCKER_IMAGE}:${REVISION}" \
--file Dockerfile.release \
--output type=docker,dest=${{ matrix.image_name }}-docker-image \
.
uses: getsentry/action-build-and-push-images@7a95ee2424cf3ab7ea99f5d753911546ad6460cc
with:
image_name: ${{ matrix.image_name }}
platforms: ${{ env.PLATFORMS }}
dockerfile_path: "./Dockerfile.release"
ghcr: true
google_ar: false
publish_on_pr: true

- name: Upload docker image
if: "github.event.pull_request.head.repo.fork || github.actor == 'dependabot[bot]'"
Expand Down Expand Up @@ -521,21 +504,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3

# Logic taken from: publish-to-gcr
- name: Google Auth
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool
service_account: [email protected]

- name: Configure docker
run: |
gcloud auth configure-docker us-central1-docker.pkg.dev

# Logic taken from: build-docker
- uses: actions/download-artifact@v4
with:
Expand All @@ -553,14 +521,17 @@ jobs:
done

- name: Build and push to Internal AR
run: |
docker buildx build \
--platform "${PLATFORMS}" \
--tag "${AR_DOCKER_IMAGE}:${REVISION}" \
$( [[ "${IS_MASTER}" == "true" ]] && printf %s "--tag ${AR_DOCKER_IMAGE}:latest" ) \
--file Dockerfile.release \
--push \
.
uses: getsentry/action-build-and-push-images@a97547ab68a7e6c555d57297806727f61a97b177
with:
image_name: ${{ matrix.image_name }}
platforms: ${{ env.PLATFORMS }}
dockerfile_path: "Dockerfile.release"
ghcr: false
publish_on_pr: true
google_ar: true
google_ar_image_name: ${{ env.AR_DOCKER_IMAGE }}
google_workload_identity_provider: projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool
google_service_account: [email protected]

publish-to-dockerhub:
needs: [build-setup, build-docker]
Expand All @@ -572,7 +543,7 @@ jobs:
matrix:
image_name: ["relay"] # Don't publish relay-pop (for now)

if: github.event_name == 'merge_group'
if: github.event_name == 'merge_group'

env:
GHCR_DOCKER_IMAGE: "ghcr.io/getsentry/${{ matrix.image_name }}"
Expand Down
Loading