Skip to content

Commit 01050dc

Browse files
committed
change snapshots to push to the same repository
1 parent 1fc4252 commit 01050dc

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

.github/workflows/publish-images.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,18 @@ jobs:
3939
with:
4040
ruby-version: "3.1"
4141
bundler-cache: true
42-
- id: rcd_image_version
43-
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT
42+
- id: rcd_config
43+
run: |
44+
bundle exec ruby -e ' \
45+
require "rake_compiler_dock" \
46+
print "image_name=" \
47+
puts RakeCompilerDock::Starter.container_image_name(:platform => %q(${{matrix.platform}})) \
48+
print "snapshot_name=" \
49+
puts RakeCompilerDock::Starter.container_image_name(:platform => %q(${{matrix.platform}}), :version => %q(snapshot)) \
50+
' | tee -a $GITHUB_OUTPUT
51+
4452
- name: Build docker image
4553
env:
46-
CONTAINER_REGISTRY: phony-registry
4754
RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load
4855
run: |
4956
docker buildx create --driver docker-container --use
@@ -56,10 +63,7 @@ jobs:
5663
registry: ghcr.io
5764
username: ${{github.actor}}
5865
password: ${{secrets.GITHUB_TOKEN}}
59-
- env:
60-
OLD_TAG: phony-registry/rake-compiler-dock-${{matrix.tag || format('mri-{0}', matrix.platform)}}:${{steps.rcd_image_version.outputs.rcd_image_version}}
61-
NEW_TAG: ghcr.io/rake-compiler/rake-compiler-dock-snapshot:${{matrix.platform}}
62-
run: |
66+
- run: |
6367
docker images
64-
docker tag ${OLD_TAG} ${NEW_TAG}
65-
docker push ${NEW_TAG}
68+
docker tag ${{steps.rcd_config.outputs.image_name}} ${{steps.rcd_config.outputs.snapshot_name}}
69+
docker push ${{steps.rcd_config.outputs.snapshot_name}}

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,9 @@ For an example of rake tasks that support this style of invocation, visit https:
221221

222222
### Living on the edge: using weekly snapshots
223223

224-
OCI images snapshotted from `master` are published weekly to Github Container Registry:
224+
OCI images snapshotted from `master` are published weekly to Github Container Registry with the string "snapshot" in place of the version number in the tag name, e.g.:
225225

226-
> https://github.com/rake-compiler/rake-compiler-dock/pkgs/container/rake-compiler-dock-snapshot
227-
228-
The images are named `ghcr.io/rake-compiler/rake-compiler-dock-snapshot` and are tagged with the platform name (e.g., `ghcr.io/rake-compiler/rake-compiler-dock-snapshot:x86_64-linux`.
226+
- `ghcr.io/rake-compiler/rake-compiler-dock-image:snapshot-mri-x86_64-linux`
229227

230228
These images are intended for integration testing. They may not work properly and should not be considered production ready.
231229

lib/rake_compiler_dock/starter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def container_image_name(options={})
166166

167167
"%s/rake-compiler-dock-image:%s-%s%s" % [
168168
container_registry,
169-
IMAGE_VERSION,
169+
options.fetch(:version) { IMAGE_VERSION },
170170
container_rubyvm(options),
171171
container_jrubyvm?(options) ? "" : "-#{options.fetch(:platform)}",
172172
]

test/test_starter.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ def test_container_image_name
6666
Starter.container_image_name({:platform => "x86_64-darwin"}),
6767
)
6868
end
69+
70+
# snapshots
71+
assert_equal(
72+
"ghcr.io/rake-compiler/rake-compiler-dock-image:snapshot-mri-x86_64-darwin",
73+
Starter.container_image_name({:platform =>"x86_64-darwin", :version => "snapshot"}),
74+
)
6975
end
7076

7177
def test_container_registry

0 commit comments

Comments
 (0)