Skip to content

Commit

Permalink
Publish directly to ghcr registry
Browse files Browse the repository at this point in the history
Don't pass by intermediate docker daemon to publish the OCI image.
  • Loading branch information
gboutry committed Jul 2, 2024
1 parent 195f0f7 commit 9499efb
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions .github/actions/publish-rock/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ inputs:
runs:
using: composite
steps:
- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ inputs.username }}
password: ${{ inputs.password }}
- name: Install skopeo
shell: bash
run: |
Expand All @@ -27,17 +21,25 @@ runs:
- name: Install yq
shell: bash
run: sudo snap install yq
- name: Log in to the Container registry
shell: bash
run: |
skopeo login ghcr.io --username "${{ inputs.username }}"" --password "${{ inputs.password }}"
- name: Import and push to github package
shell: bash
run: |
rock_file="${{ inputs.rock }}"
rockdir=$(dirname $rock_file)
image_name="$(yq '.name' $rockdir/rockcraft.yaml)"
version="$(yq '.version' $rockdir/rockcraft.yaml)"
echo "Publishing rock ${image_name}:${version}"
sudo skopeo \
--insecure-policy \
copy \
oci-archive:"${rock_file}" \
docker-daemon:"ghcr.io/canonical/${image_name}:${version}"
echo "Publishing rock ${image_name}:${version}"
docker push ghcr.io/canonical/${image_name}:${version}
docker://"ghcr.io/canonical/${image_name}:${version}"
- name: Log out of the Container registry
if: always()
shell: bash
run: |
skopeo logout ghcr.io

0 comments on commit 9499efb

Please sign in to comment.