|
@@ -2,6 +2,11 @@ name: Release Docker Image
|
|
|
|
|
|
on:
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_dispatch:
|
|
|
|
+ inputs:
|
|
|
|
+ image_tag:
|
|
|
|
+ description: '镜像标签,留空则使用 package.json 中的版本号。务必注意:请确认选择了正确的分支。完整输入示例:3.0.11-rc0 '
|
|
|
|
+ required: true
|
|
|
|
+ default: ''
|
|
push:
|
|
push:
|
|
branches:
|
|
branches:
|
|
- master
|
|
- master
|
|
@@ -10,12 +15,27 @@ jobs:
|
|
build:
|
|
build:
|
|
name: build
|
|
name: build
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
-
|
|
|
|
|
|
+ strategy:
|
|
|
|
+ matrix:
|
|
|
|
+ string:
|
|
|
|
+ - package_json: "app/package.json"
|
|
permissions:
|
|
permissions:
|
|
packages: write
|
|
packages: write
|
|
contents: read
|
|
contents: read
|
|
|
|
|
|
steps:
|
|
steps:
|
|
|
|
+ - name: Checkout repository and submodules
|
|
|
|
+ uses: actions/checkout@v4
|
|
|
|
+ with:
|
|
|
|
+ ref: ${{ github.event.ref }}
|
|
|
|
+ submodules: recursive
|
|
|
|
+
|
|
|
|
+ - name: Extract version from package.json
|
|
|
|
+ uses: sergeysova/jq-action@v2
|
|
|
|
+ id: version
|
|
|
|
+ with:
|
|
|
|
+ cmd: "jq .version ${{ matrix.string.package_json }} -r"
|
|
|
|
+
|
|
- name: Free Disk Space (Ubuntu)
|
|
- name: Free Disk Space (Ubuntu)
|
|
uses: jlumbroso/free-disk-space@main
|
|
uses: jlumbroso/free-disk-space@main
|
|
with:
|
|
with:
|
|
@@ -32,21 +52,24 @@ jobs:
|
|
docker-images: true
|
|
docker-images: true
|
|
swap-storage: true
|
|
swap-storage: true
|
|
|
|
|
|
- - name: Check out the repo
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
- name: Set up QEMU
|
|
- name: Set up QEMU
|
|
- uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
+ uses: docker/setup-qemu-action@v3
|
|
|
|
|
|
- name: Setup Docker buildx
|
|
- name: Setup Docker buildx
|
|
- uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
+ uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
- name: Log in to Docker Hub
|
|
- name: Log in to Docker Hub
|
|
- uses: docker/login-action@v2
|
|
|
|
|
|
+ uses: docker/login-action@v3
|
|
with:
|
|
with:
|
|
username: ${{ secrets.DOCKER_HUB_USER }}
|
|
username: ${{ secrets.DOCKER_HUB_USER }}
|
|
password: ${{ secrets.DOCKER_HUB_PWD }}
|
|
password: ${{ secrets.DOCKER_HUB_PWD }}
|
|
|
|
|
|
- - name: Build the Docker image
|
|
|
|
|
|
+ - 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,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v${{ github.event.inputs.image_tag }} .
|
|
|
|
+ - name: Build the Docker image use package_json version
|
|
|
|
+ if: ${{ github.event_name == 'push' || github.event.inputs.image_tag == '' }}
|
|
run: |
|
|
run: |
|
|
- docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v3.0.11 .
|
|
|
|
|
|
+ docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t b3log/siyuan:latest -t b3log/siyuan:v${{ steps.version.outputs.value }} .
|
|
|
|
+
|