Get-AMD64-Docker-Images-Release #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Get-AMD64-Docker-Images-Release | |
on: | |
workflow_dispatch: | |
inputs: | |
docker_images: | |
description: '请填写docker镜像名称,多个用英文逗号分开' | |
required: true | |
default: 'alpine:latest,alpine/curl,busybox:stable-glibc' | |
jobs: | |
pull_and_package: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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" | |
image_name="${image//\//_}" | |
image_name="${image_name//:/_}" | |
docker save "${image}" -o "${image_name}-amd64.tar" | |
gzip -c "${image_name}-amd64.tar" > "${image_name}-amd64.tar.gz" | |
rm "${image_name}-amd64.tar" | |
done | |
- name: List generated files (debug step) | |
run: | | |
echo "Preparing docker images list (.tar.gz) files:" | |
find $GITHUB_WORKSPACE -name "*.tar.gz" | |
release_name=$(TZ="Asia/Shanghai" date +'%Y-%m-%d %H:%M Build') | |
echo "RELEASE_NAME=$release_name" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@master | |
with: | |
tag_name: DockerTarBuilder-AMD64 | |
name: ${{ env.RELEASE_NAME }} for x86-64 | |
body: | | |
[![Github](https://img.shields.io/badge/RELEASE:DockerTarBuilder-123456?logo=github&logoColor=fff&labelColor=green&style=for-the-badge)](https://www.bilibili.com/video/BV1EZ421M7mL) [![Github](https://img.shields.io/badge/国内加速站下载-FC7C0D?logo=github&logoColor=fff&labelColor=000&style=for-the-badge)](https://wkdaily.cpolar.top/archives/1) | |
### How to use? For example | |
`docker load -i alpine_latest.tar.gz ` | |
### Video teaching | |
[![Bilibili](https://img.shields.io/badge/Bilibili-123456?logo=bilibili&logoColor=fff&labelColor=fb7299)](https://www.bilibili.com/video/BV1EZ421M7mL) | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Docker images as release assets | |
uses: softprops/action-gh-release@master | |
with: | |
tag_name: DockerTarBuilder-AMD64 | |
files: ${{ github.workspace }}/*.tar.gz | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |