🔖 Release v3.8.3 #268
Workflow file for this run
This file contains hidden or 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: | |
| push: | |
| tags: | |
| - 'v*' | |
| - '!*alpha*' | |
| - '!*beta*' | |
| - '!*rc*' | |
| workflow_dispatch: | |
| env: | |
| package_json: "app/package.json" | |
| docker_hub_owner: "b3log" | |
| docker_hub_repo: "siyuan" | |
| jobs: | |
| build: | |
| if: ${{ github.repository_owner == 'siyuan-note' }} | |
| name: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: read | |
| steps: | |
| - name: Checkout repository and submodules | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.ref }} | |
| submodules: recursive | |
| - name: Extract version from package.json | |
| id: version | |
| run: | | |
| echo "value=$(jq .version ${{ env.package_json }} -r)" >> $GITHUB_OUTPUT | |
| - name: Verify tag matches package.json version | |
| # 去掉 tag 前导 v 后与 package.json 中的版本号比对, | |
| # 不一致说明开发者推 tag 前忘记同步版本号,直接终止整个流程。 | |
| run: | | |
| TAG="${GITHUB_REF_NAME#v}" | |
| VERSION="${{ steps.version.outputs.value }}" | |
| if [ "$TAG" != "$VERSION" ]; then | |
| echo "Tag (v$TAG) does not match version in package.json ($VERSION), stopping" | |
| exit 1 | |
| fi | |
| echo "Tag matches version: $TAG" | |
| - 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: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Setup Docker buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USER }} | |
| password: ${{ secrets.DOCKER_HUB_PWD }} | |
| - name: Build and push Docker image | |
| # 走到这里的一定是 stable 版本,直接同时打 :latest 和具体版本号标签 | |
| run: | | |
| 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 }} . |