Skip to content

Commit

Permalink
简化工作流
Browse files Browse the repository at this point in the history
  • Loading branch information
wukongdaily authored Dec 10, 2024
1 parent af9a39c commit 67c55d8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/amd64-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
docker_images:
description: '请填写docker镜像名称多个用英文逗号分开'
description: '请填写docker镜像名称,多个用英文逗号分开'
required: true
default: 'alpine:latest,alpine/curl,busybox:stable-glibc'

Expand Down
30 changes: 13 additions & 17 deletions .github/workflows/amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
docker_images:
description: '请填写docker镜像名称 多个用英文逗号分开'
required: true
default: 'alpine:latest' # 设置默认的 Docker 镜像列表
default: 'alpine:latest,busybox:stable-glibc' # 设置默认的 Docker 镜像列表

jobs:
pull_and_package:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand All @@ -23,22 +23,18 @@ jobs:
- name: Pull Docker Images and Package
run: |
images="${{ github.event.inputs.docker_images }}"
IFS=',' read -r -a image_array <<< "$images"
for image in "${image_array[@]}"; do
docker pull "${image}" --platform "linux/amd64"
docker save "${image}" -o "${image//\//_}-amd64.tar"
done
- name: Compress the TAR files
run: tar -czf x86-64-images.tar.gz *-amd64.tar
IFS=',' read -r -a image_array <<< "$images"
for image in "${image_array[@]}"; do
docker pull "${image}" --platform "linux/amd64"
image_name="${image//\//_}"
image_name="${image_name//:/_}"
docker save "${image}" -o "${image_name}-amd64.tar"
tar -czf "${image_name}.tar.gz" "${image_name}-amd64.tar"; rm "${image_name}-amd64.tar"
done
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docker-images-tar
path: x86-64-images.tar.gz
retention-days: 1 # 将保留天数设置为 1 天 最多可设置90天

- name: Clean up intermediate files
run: |
rm *-amd64.tar
name: my-artifact
path: ${{ github.workspace }}/*.tar.gz
retention-days: 1 # 将保留天数设置为 1 天 最多可设置90天
28 changes: 12 additions & 16 deletions .github/workflows/arm32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
docker_images:
description: '请填写docker镜像名称 多个用英文逗号分开'
required: true
default: 'alpine:latest,ubuntu:latest' # 设置默认的 Docker 镜像列表
default: 'alpine:latest,busybox:stable-glibc' # 设置默认的 Docker 镜像列表

jobs:
pull_and_package:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand All @@ -19,22 +19,18 @@ jobs:
- name: Pull Docker Images and Package
run: |
images="${{ github.event.inputs.docker_images }}"
IFS=',' read -r -a image_array <<< "$images"
for image in "${image_array[@]}"; do
docker pull "${image}" --platform "linux/arm/v7"
docker save "${image}" -o "${image//\//_}-arm32.tar"
done
- name: Compress the TAR files
run: tar -czf arm32-images.tar.gz *-arm32.tar
IFS=',' read -r -a image_array <<< "$images"
for image in "${image_array[@]}"; do
docker pull "${image}" --platform "linux/arm/v7"
image_name="${image//\//_}"
image_name="${image_name//:/_}"
docker save "${image}" -o "${image_name}-arm32.tar"
tar -czf "${image_name}.tar.gz" "${image_name}-arm32.tar"; rm "${image_name}-arm32.tar"
done
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docker-images-tar
path: arm32-images.tar.gz
name: my-artifact
path: ${{ github.workspace }}/*.tar.gz
retention-days: 1 # 将保留天数设置为 1 天 最多可设置90天

- name: Clean up intermediate files
run: |
rm *-arm32.tar
27 changes: 12 additions & 15 deletions .github/workflows/arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:
docker_images:
description: '请填写docker镜像名称 多个用英文逗号分开'
required: true
default: 'alpine:latest,ubuntu:latest' # 设置默认的 Docker 镜像列表
default: 'alpine:latest,busybox:stable-glibc' # 设置默认的 Docker 镜像列表

jobs:
pull_and_package:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
Expand All @@ -19,22 +19,19 @@ jobs:
- name: Pull Docker Images and Package
run: |
images="${{ github.event.inputs.docker_images }}"
IFS=',' read -r -a image_array <<< "$images"
for image in "${image_array[@]}"; do
docker pull "${image}" --platform "linux/arm64"
docker save "${image}" -o "${image//\//_}-arm64.tar"
done
- name: Compress the TAR files
run: tar -czf arm64-images.tar.gz *-arm64.tar
IFS=',' read -r -a image_array <<< "$images"
for image in "${image_array[@]}"; do
docker pull "${image}" --platform "linux/arm64"
image_name="${image//\//_}"
image_name="${image_name//:/_}"
docker save "${image}" -o "${image_name}-arm64.tar"
tar -czf "${image_name}.tar.gz" "${image_name}-arm64.tar"; rm "${image_name}-arm64.tar"
done
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: docker-images-tar
path: arm64-images.tar.gz
name: my-artifact
path: ${{ github.workspace }}/*.tar.gz
retention-days: 1 # 将保留天数设置为 1 天 最多可设置90天

- name: Clean up intermediate files
run: |
rm *-arm64.tar

0 comments on commit 67c55d8

Please sign in to comment.