Release Docker Image #58
Workflow file for this run
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: Release Docker Image | |
on: | |
workflow_dispatch: | |
# 务必注意:手动触发时请确认选择了正确的分支 | |
inputs: | |
image_tag: | |
description: '镜像标签,留空则使用 package.json 中的版本号。完整输入示例:v0.27.25-rc0 ' | |
required: true | |
default: '' | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
string: | |
- repo_name_android: "Sillot-android" | |
repo_name: "Sillot" | |
repo_owner: "Hi-Windom" | |
package_json: "app/package.json" | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: false | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: Checkout repository and submodules | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.ref }} | |
submodules: recursive | |
- name: Extract Sillot version from package.json | |
uses: sergeysova/jq-action@v2 | |
id: version | |
with: | |
cmd: "jq .version ${{ matrix.string.package_json }} -r" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_PWD }} | |
- name: Build the Docker image use Workflow Dispatch inputs' version | |
if: ${{ github.event_name == 'workflow_dispatch' && !github.event.inputs.image_tag == '' }} | |
run: | | |
docker buildx build --push --platform linux/amd64 -t soltus/sillot:latest -t soltus/sillot:${{ github.event.inputs.image_tag }}-sillot . | |
- name: Build the Docker image use package_json version | |
if: ${{ github.event_name == 'push' || github.event.inputs.image_tag == '' }} | |
run: | | |
docker buildx build --push --platform linux/amd64 -t soltus/sillot:latest -t soltus/sillot:${{ steps.version.outputs.value }}-sillot . | |
- name: Update Docker Hub Description | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_PWD }} | |
repository: soltus/sillot # 这是 docker hub 的不是 github 的 | |
readme-filepath: ./.github/README.md | |
short-description: ${{ github.event.repository.description }} | |
enable-url-completion: false |