upgrade github actions

This commit is contained in:
MaysWind
2026-05-04 16:00:14 +08:00
parent 0038321781
commit 39ee47e05a
10 changed files with 92 additions and 109 deletions
@@ -3,81 +3,78 @@ name: Build docker image and package for linux
inputs:
release-build:
required: false
type: string
description: "Whether to build the linux package in release mode. If set to '1', the package will be built in release mode. Otherwise, it will be built in development mode."
build-unix-time:
required: false
type: string
description: "The unix time to use for building the linux package. The value should be a string representing the unix time in seconds."
build-date:
required: false
type: string
description: "The date to use for building the linux package. The value should be a string representing the date in the format of 'YYYYMMDD'."
check-3rd-api:
required: false
type: string
description: "Whether to run integration tests that call third party APIs. If set to '1', the tests will be run. Otherwise, the tests will be skipped."
skip-tests:
required: false
type: string
description: "Whether to skip tests when building the linux package. If set to '1', the tests will be skipped. Otherwise, the tests will be run."
platform:
required: true
type: string
description: "The platform to build the linux package for. The value should be in the format of 'os/arch[/variant]'. For example, 'linux/amd64', 'linux/arm64/v8', 'linux/arm/v7', or 'linux/arm/v6'."
platform-name:
required: true
type: string
description: "The name of the platform to build the linux package for. The value should be a string that can be used in file names. For example, 'linux-amd64', 'linux-arm64', 'linux-armv7', or 'linux-armv6'."
docker-push:
required: true
type: boolean
description: "Whether to push the built docker image to the registry. If set to 'true', the image will be pushed. Otherwise, it will not be pushed."
docker-image-name:
required: true
type: string
required: false
description: "The repository name of the docker image to build. This is required if 'docker-push' is set to 'true'."
docker-username:
required: false
type: string
description: "Username for logging in to the docker registry. This is required if 'docker-push' is set to 'true'."
docker-password:
required: false
type: string
description: "Password for logging in to the docker registry. This is required if 'docker-push' is set to 'true'."
docker-bake-meta-file-path:
required: true
type: string
description: "The file path to the docker bake meta file."
docker-bake-meta-artifact-name:
required: true
type: string
description: "The name of the artifact that contains the docker bake meta file."
docker-bake-digests-file-path:
required: true
type: string
description: "The file path to save the docker bake digests file. The file will be created with the name of the digest under this path."
docker-bake-digests-artifact-name-prefix:
required: true
type: string
description: "The prefix for the docker bake digests artifact name."
package-file-name-prefix:
required: true
type: string
package-artifact-name-prefix:
required: true
type: string
description: "The prefix for the linux package file name."
runs:
using: "composite"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4
- name: Download docker bake meta artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: ${{ inputs.docker-bake-meta-artifact-name }}
path: ${{ runner.temp }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
if: ${{ inputs.docker-username != '' && inputs.docker-password != '' }}
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ inputs.docker-username }}
password: ${{ inputs.docker-password }}
- name: Build docker for ${{ inputs.platform-name }}
id: bake
uses: docker/bake-action@v6
uses: docker/bake-action@v7
with:
files: |
./docker-bake.hcl
@@ -110,15 +107,15 @@ runs:
tar -czf ${{ runner.temp }}/${{ inputs.package-file-name-prefix }}-${{ inputs.platform-name }}.tar.gz *
- name: Upload ${{ inputs.platform-name }} digests artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ inputs.docker-bake-digests-artifact-name-prefix }}-${{ inputs.platform-name }}
path: ${{ inputs.docker-bake-digests-file-path }}/*
if-no-files-found: error
- name: Upload artifact for ${{ inputs.platform-name }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: ${{ inputs.package-artifact-name-prefix }}-${{ inputs.platform-name }}
archive: false
path: ${{ runner.temp }}/${{ inputs.package-file-name-prefix }}-${{ inputs.platform-name }}.tar.gz
if-no-files-found: error