Skip to content

Commit

Permalink
chore: use local registry
Browse files Browse the repository at this point in the history
  • Loading branch information
M7mdisk committed Jul 29, 2024
1 parent 837be02 commit 6311fed
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/publish_charm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
jobs:
pack-charm:
# only run when ./charm content changes
#if: ${{ github.event_name == 'push' && contains(github.event.commits.*.added, 'charm') || contains(github.event.commits.*.modified, 'charm') }}
if: ${{ github.event_name == 'push' && contains(github.event.commits.*.added, 'charm') || contains(github.event.commits.*.modified, 'charm') }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -37,6 +37,7 @@ jobs:

pack-rock:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -76,16 +77,31 @@ jobs:
with:
name: charmhub-io-rock

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host

- name: Set image URL
id: set_image_url
run: echo "image_url=ghcr.io/canonical/charmhub.io:$(date +%s)-${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT

- name: Push to GHCR
run: skopeo --insecure-policy copy oci-archive:$(ls *.rock) docker://${{ steps.set_image_url.outputs.image_url }} --dest-creds "canonical:${{ secrets.GITHUB_TOKEN }}"
- name: get image digest
id: set_image_digest
run: skopeo inspect --creds "canonical:${{ secrets.GITHUB_TOKEN }}" docker://${{ steps.set_image_url.outputs.image_url }} | jq -r '.Digest' >> $GITHUB_OUTPUT
- name: upload flask OCI image

- name: Push to local registry
run: skopeo --insecure-policy copy oci-archive:$(ls *.rock) docker-daemon://localhost:5000/charmhub-io:latest

- name: Get image digest
id: get_image_digest
run: |
digest=$(skopeo inspect docker-daemon://localhost:5000/charmhub-io:latest | jq -r '.Digest')
echo "image_digest=$digest" >> $GITHUB_OUTPUT
- name: Upload flask app OCI image
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMHUB_TOKEN }}
run: charmcraft upload-resource charmhub-io flask-app-image --image=${{ needs.publish-image.outputs.image_url }} --verbosity=trace
run: charmcraft upload-resource charmhub-io flask-app-image --image=${{ steps.get_image_digest.outputs.image_digest }} --verbosity=trace

0 comments on commit 6311fed

Please sign in to comment.