Update test.yml

This commit is contained in:
wukongdaily 2024-06-15 17:24:08 +08:00 committed by GitHub
parent eabd922860
commit 78e3613913
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,35 +17,35 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Pull, Save, and Compress Docker Images - name: Pull, Save, and Compress Docker Images
run: | run: |
images="${{ github.event.inputs.docker_images }}" images="${{ github.event.inputs.docker_images }}"
platform="${{ github.event.inputs.platform }}" platform="${{ github.event.inputs.platform }}"
IFS=',' read -r -a image_array <<< "$images" IFS=',' read -r -a image_array <<< "$images"
for image in "${image_array[@]}"; do for image in "${image_array[@]}"; do
echo "Pulling $image for platform $platform" echo "Pulling $image for platform $platform"
docker pull --platform "$platform" "$image" docker pull --platform "$platform" "$image"
image_name="${image//\//_}_${platform}" image_name="${image//\//_}_${platform}"
docker save "$image" -o "${image_name}.tar" docker save "$image" -o "${image_name}.tar"
tar -czf "${image_name}.tar.gz" "${image_name}.tar" tar -czf "${image_name}.tar.gz" "${image_name}.tar"
rm -f "${image_name}.tar" rm -f "${image_name}.tar"
# Save image information to environment file # Save image path to environment file
echo "${image}_IMAGE_PATH=${{ runner.temp }}/${image_name}.tar.gz" >> $GITHUB_ENV echo "${image}_IMAGE_PATH=${{ runner.temp }}/${image_name}.tar.gz" >> $GITHUB_ENV
done done
- name: Clean up intermediate files - name: Clean up intermediate files
run: | run: |
rm -f *.tar rm -f *.tar
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: docker-images-tar name: docker-images-tar
path: '*.tar.gz' path: '*.tar.gz'