Skip to content

Commit

Permalink
add platform option
Browse files Browse the repository at this point in the history
  • Loading branch information
whhe committed Jun 19, 2024
1 parent ac106ff commit ac5deb8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,26 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v4

- name: Get the image name
id: get-image-name
- name: Get the image info
run: |
TAG_NAME="${GITHUB_REF#refs/tags/}"
IMAGE_NAME="${TAG_NAME//--/:}"
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
tag_name="${GITHUB_REF#refs/tags/}"
image_name="${tag_name//--/:}"
platform="amd64"
regex="(.+)(-amd64|-arm64)$"
if [[ $image_name =~ $regex ]]; then
image_name="${BASH_REMATCH[1]}"
platform="${BASH_REMATCH[2]#-}"
fi
echo "image_name=$image_name" >> $GITHUB_ENV
echo "platform=$platform" >> $GITHUB_ENV
- name: Pull Docker image
run: docker pull "$IMAGE_NAME"
run: docker pull --platform linux/"$platform" "$image_name"

- name: Export Docker image
run: docker save -o image.tar "$IMAGE_NAME"
run: docker save -o image.tar "$image_name"

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit ac5deb8

Please sign in to comment.