Update test.yml
This commit is contained in:
parent
cf6b4baf55
commit
38d46dede1
|
@ -1,11 +1,12 @@
|
||||||
name: test
|
name: Docker Pull and Package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
docker_image:
|
docker_images:
|
||||||
description: 'Docker image to pull'
|
description: 'Comma-separated list of Docker images to pull'
|
||||||
required: true
|
required: true
|
||||||
default: 'alpine:latest' # 你可以设置一个默认值
|
default: 'alpine:latest,ubuntu:latest' # 你可以设置一个默认值
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pull_and_package:
|
pull_and_package:
|
||||||
|
@ -15,18 +16,20 @@ jobs:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Pull Docker Image
|
- name: Pull Docker Images
|
||||||
run: docker pull ${{ github.event.inputs.docker_image }}
|
run: |
|
||||||
|
images="${{ github.event.inputs.docker_images }}"
|
||||||
|
IFS=',' read -r -a image_array <<< "$images"
|
||||||
|
for image in "${image_array[@]}"; do
|
||||||
|
docker pull "$image"
|
||||||
|
docker save "$image" -o "${image//\//_}.tar"
|
||||||
|
done
|
||||||
|
|
||||||
- name: Save Docker Image to TAR
|
- name: Compress the TAR files
|
||||||
run: docker save ${{ github.event.inputs.docker_image }} -o image.tar
|
run: tar -czf images.tar.gz *.tar
|
||||||
|
|
||||||
- name: Compress the TAR file
|
|
||||||
run: tar -czf image.tar.gz image.tar
|
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: docker-image-tar
|
name: docker-images-tar
|
||||||
path: image.tar.gz
|
path: images.tar.gz
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue