-
-
Notifications
You must be signed in to change notification settings - Fork 18
gha: image build needs package write #607
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
Merged
Merged
Conversation
This file contains hidden or 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
Jeffreyhung
approved these changes
Jul 1, 2025
Comment on lines
+15
to
+65
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | ||
- name: builder-image | ||
run: | | ||
set -euxo pipefail | ||
|
||
img=ghcr.io/getsentry/craft-builder:latest | ||
args=() | ||
if docker pull -q "$img"; then | ||
args+=(--cache-from "$img") | ||
fi | ||
docker buildx build \ | ||
"${args[@]}" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--target builder \ | ||
--tag "$img" \ | ||
. | ||
- name: image | ||
run: | | ||
set -euxo pipefail | ||
img=ghcr.io/getsentry/craft-builder:latest | ||
args=() | ||
if docker pull -q "$img"; then | ||
args+=(--cache-from "$img") | ||
fi | ||
docker buildx build \ | ||
"${args[@]}" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--target builder \ | ||
--tag "$img" \ | ||
. | ||
- name: image | ||
run: | | ||
set -euxo pipefail | ||
|
||
img=ghcr.io/getsentry/craft:latest | ||
args=() | ||
if docker pull -q "$img"; then | ||
args+=(--cache-from "$img") | ||
fi | ||
docker buildx build \ | ||
"${args[@]}" \ | ||
--build-arg "SOURCE_COMMIT=$GITHUB_SHA" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--tag "$img" \ | ||
. | ||
- name: docker login | ||
run: docker login --username "$DOCKER_USER" --password-stdin ghcr.io <<< "$DOCKER_PASS" | ||
env: | ||
DOCKER_USER: ${{ github.actor }} | ||
DOCKER_PASS: ${{ secrets.GITHUB_TOKEN }} | ||
if: github.event_name != 'pull_request' | ||
- name: docker push | ||
run: | | ||
set -euxo pipefail | ||
img=ghcr.io/getsentry/craft:latest | ||
args=() | ||
if docker pull -q "$img"; then | ||
args+=(--cache-from "$img") | ||
fi | ||
docker buildx build \ | ||
"${args[@]}" \ | ||
--build-arg "SOURCE_COMMIT=$GITHUB_SHA" \ | ||
--build-arg BUILDKIT_INLINE_CACHE=1 \ | ||
--tag "$img" \ | ||
. | ||
- name: docker login | ||
run: docker login --username "$DOCKER_USER" --password-stdin ghcr.io <<< "$DOCKER_PASS" | ||
env: | ||
DOCKER_USER: ${{ github.actor }} | ||
DOCKER_PASS: ${{ secrets.GITHUB_TOKEN }} | ||
if: github.event_name != 'pull_request' | ||
- name: docker push | ||
run: | | ||
set -euxo pipefail | ||
|
||
craft_builder=ghcr.io/getsentry/craft-builder:latest | ||
craft_latest=ghcr.io/getsentry/craft:latest | ||
craft_versioned="ghcr.io/getsentry/craft:${GITHUB_SHA}" | ||
craft_builder=ghcr.io/getsentry/craft-builder:latest | ||
craft_latest=ghcr.io/getsentry/craft:latest | ||
craft_versioned="ghcr.io/getsentry/craft:${GITHUB_SHA}" | ||
|
||
docker push "$craft_builder" | ||
docker push "$craft_builder" | ||
|
||
docker tag "$craft_latest" "$craft_versioned" | ||
docker push "$craft_versioned" | ||
docker push "$craft_latest" | ||
if: github.event_name != 'pull_request' | ||
docker tag "$craft_latest" "$craft_versioned" | ||
docker push "$craft_versioned" | ||
docker push "$craft_latest" | ||
if: github.event_name != 'pull_request' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't change unrelated things
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixing permissions here. This need packages
write
in order to push the container to GHCR.