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 29bef88
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 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 @@ -82,10 +83,19 @@ jobs:

- 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: pull image into registry
run: docker pull ${{ steps.set_image_url.outputs.image_url }}

- name: Get image digest
id: get_image_digest
run: |
digest=$(skopeo inspect docker://${{ steps.set_image_url.outputs.image_url }} | 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: |
sudo snap install charmcraft --classic --channel=latest/edge
charmcraft upload-resource charmhub-io flask-app-image --image=${{ steps.get_image_digest.outputs.image_digest }} --verbosity=trace

0 comments on commit 29bef88

Please sign in to comment.