Skip to content

Commit

Permalink
chore: fix ghcr app push yet again (All-Hands-AI#3482)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyaoww authored Aug 19, 2024
1 parent 058dd5a commit 94590aa
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/ghcr_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.capture-tags.outputs.tags }}
last_tag: ${{ steps.capture-last-tag.outputs.last_tag }}
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -65,11 +66,16 @@ jobs:
tags=$(cat tags.txt)
echo "tags=$tags"
echo "tags=$tags" >> $GITHUB_OUTPUT
- name: Capture last tag
id: capture-last-tag
run: |
last_tag=$(cat tags.txt | awk '{print $NF}')
echo "last_tag=$last_tag" >> $GITHUB_OUTPUT
- name: Upload Docker image as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.image }}_image_${{ matrix.platform }}
path: /tmp/${{ matrix.image }}_image_${{ matrix.platform }}.tar
name: ${{ matrix.image }}_${{ steps.capture-last-tag.outputs.last_tag }}_${{ matrix.platform }}
path: /tmp/${{ matrix.image }}_${{ steps.capture-last-tag.outputs.last_tag }}_${{ matrix.platform }}.tar
retention-days: 14

# Push the OpenHands and sandbox Docker images to the ghcr.io repository
Expand All @@ -85,6 +91,7 @@ jobs:
strategy:
matrix:
image: ['openhands']
last_tag: ${{ needs.ghcr_build.outputs.last_tag }}
platform: ['amd64', 'arm64']
steps:
- name: Checkout code
Expand All @@ -98,12 +105,12 @@ jobs:
- name: Download Docker images
uses: actions/download-artifact@v4
with:
name: ${{ matrix.image }}_image_${{ matrix.platform }}
name: ${{ matrix.image }}_${{ matrix.last_tag }}_${{ matrix.platform }}
path: /tmp
- name: Load images and push to registry
run: |
mv /tmp/${{ matrix.platform }}/${{ matrix.image }}_image_${{ matrix.platform }}.tar .
loaded_image=$(docker load -i ${{ matrix.image }}_image_${{ matrix.platform }}.tar | grep "Loaded image:" | head -n 1 | awk '{print $3}')
mv /tmp/${{ matrix.platform }}/${{ matrix.image }}_${{ matrix.last_tag }}_${{ matrix.platform }}.tar .
loaded_image=$(docker load -i ${{ matrix.image }}_${{ matrix.last_tag }}_${{ matrix.platform }}.tar | grep "Loaded image:" | head -n 1 | awk '{print $3}')
echo "loaded image = $loaded_image"
tags=$(echo ${tags} | tr ' ' '\n')
image_name=$(echo "ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}" | tr '[:upper:]' '[:lower:]')
Expand Down

0 comments on commit 94590aa

Please sign in to comment.