A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang. (PERSONAL FORK)
at lambda-fork/main 79 lines 2.8 kB view raw
1name: Release Docker Image 2 3on: 4 workflow_dispatch: 5 inputs: 6 image_tag: 7 description: '镜像标签,留空则使用 package.json 中的版本号。务必注意:请确认选择了正确的分支。完整输入示例:3.0.11-rc0 ' 8 required: true 9 default: '' 10 push: 11 branches: 12 - master 13 14# ref https://docs.github.com/zh/actions/learn-github-actions/variables 15env: 16 repo_name_android: "siyuan-android" 17 repo_name: "siyuan" 18 repo_owner: "siyuan-note" 19 package_json: "app/package.json" 20 docker_hub_owner: "b3log" 21 docker_hub_repo: "siyuan" 22 23jobs: 24 build: 25 name: build 26 runs-on: ubuntu-latest 27 permissions: 28 packages: write 29 contents: read 30 31 steps: 32 - name: Checkout repository and submodules 33 uses: actions/checkout@v4 34 with: 35 ref: ${{ github.event.ref }} 36 submodules: recursive 37 38 - name: Extract version from package.json 39 uses: sergeysova/jq-action@v2 40 id: version 41 with: 42 cmd: "jq .version ${{ env.package_json }} -r" 43 44 - name: Free Disk Space (Ubuntu) 45 uses: jlumbroso/free-disk-space@main 46 with: 47 # this might remove tools that are actually needed, 48 # if set to "true" but frees about 6 GB 49 tool-cache: false 50 51 # all of these default to true, but feel free to set to 52 # "false" if necessary for your workflow 53 android: true 54 dotnet: true 55 haskell: true 56 large-packages: true 57 docker-images: true 58 swap-storage: true 59 60 - name: Set up QEMU 61 uses: docker/setup-qemu-action@v3 62 63 - name: Setup Docker buildx 64 uses: docker/setup-buildx-action@v3 65 66 - name: Log in to Docker Hub 67 uses: docker/login-action@v3 68 with: 69 username: ${{ secrets.DOCKER_HUB_USER }} 70 password: ${{ secrets.DOCKER_HUB_PWD }} 71 72 - name: Build the Docker image use Workflow Dispatch inputs' version 73 if: ${{ github.event_name == 'workflow_dispatch' && !github.event.inputs.image_tag == '' }} 74 run: | 75 docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t ${{ env.docker_hub_owner }}/${{ env.docker_hub_repo }}:latest -t ${{ env.docker_hub_owner }}/${{ env.docker_hub_repo }}:v${{ github.event.inputs.image_tag }} . 76 - name: Build the Docker image use package_json version 77 if: ${{ github.event_name == 'push' || github.event.inputs.image_tag == '' }} 78 run: | 79 docker buildx build --push --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8 -t ${{ env.docker_hub_owner }}/${{ env.docker_hub_repo }}:latest -t ${{ env.docker_hub_owner }}/${{ env.docker_hub_repo }}:v${{ steps.version.outputs.value }} .