From e8e13c8bcb461d047e0910cc2ee79594b0893c0b Mon Sep 17 00:00:00 2001 From: Emptylight <1378990254@qq.com> Date: Mon, 16 Mar 2026 20:08:04 +0800 Subject: [PATCH] :construction_worker: Update workflow files (#17235) * :construction_worker: Fix cd.yml on forked repository exclude JesseTG/rm@v1.0.2 and actions/upload-release-asset@v1 These actions are archived * :green_heart: Update dockerimage.yml (cherry picked from commit 78bc22a42e242b2f022490c90c7f1a5771bf7e67) :green_heart: Comment unused env (cherry picked from commit 688a45ef1bc346ab468c1f2065d3a99ee718f0b3) * :art: Reset single quoto to double quote (cherry picked from commit e051bff387e8b317e3b9c075affb0b7b17149364) * :green_heart: Update auto_aur_release_stable.yml (cherry picked from commit 6daf5c6ffafc468a138ad48a85168a5b69a12acb) :green_heart: Use $GITHUB_OUTPUT instead set-output https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ (cherry picked from commit 918d2cf4230bd380641dd195c7297c4a3d594678) * :art: Remove unused environment vars (cherry picked from commit 88ddb990c1ab10819c6acd5fc74076e4816048b9) --- .github/workflows/auto_aur_release_stable.yml | 12 +- .github/workflows/cd.yml | 201 +++++++++--------- .github/workflows/dockerimage.yml | 11 +- scripts/parse-changelog-HEAD.py | 3 +- 4 files changed, 112 insertions(+), 115 deletions(-) diff --git a/.github/workflows/auto_aur_release_stable.yml b/.github/workflows/auto_aur_release_stable.yml index 6d95483cf..edc676c70 100644 --- a/.github/workflows/auto_aur_release_stable.yml +++ b/.github/workflows/auto_aur_release_stable.yml @@ -4,6 +4,8 @@ on: release: types: [published] +# https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ + jobs: build: if: ${{ github.repository_owner == 'siyuan-note' }} @@ -14,20 +16,20 @@ jobs: run: | if [[ "${{ github.ref }}" == *"dev"* ]]; then echo "Skip the workflow as the tag contains 'dev'" - echo "::set-output name=skip::true" + echo "skip=true" >> $GITHUB_OUTPUT else echo "Continue the workflow" - echo "::set-output name=skip::false" + echo "skip=false" >> $GITHUB_OUTPUT fi shell: bash - name: Extract tag name id: get_version - run: echo ::set-output name=TAG_VERSION::${{ github.event.release.tag_name }} + run: echo "TAG_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT - name: Extra tag name without v id: get_version_without_v - run: echo ::set-output name=TAG_VERSION_WITHOUT_V::$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//') + run: echo "TAG_VERSION_WITHOUT_V=$(echo '${{ github.event.release.tag_name }}' | sed 's/^v//')" >> $GITHUB_OUTPUT - name: Create PKGBUILD run: | @@ -95,7 +97,7 @@ jobs: EOF - name: Publish AUR package - uses: KSXGitHub/github-actions-deploy-aur@v2.7.2 + uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 with: pkgname: siyuan-bin pkgbuild: ./PKGBUILD diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b0f8c1c44..8219f4683 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,9 +8,6 @@ on: # ref https://docs.github.com/zh/actions/learn-github-actions/variables env: - repo_name_android: "siyuan-android" - repo_name: "siyuan" - repo_owner: "siyuan-note" package_json: "app/package.json" jobs: @@ -24,10 +21,10 @@ jobs: packageManager: ${{ steps.packageManager.outputs.value }} steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.11" - run: pip install PyGithub @@ -45,7 +42,7 @@ jobs: uses: sergeysova/jq-action@v2 id: version with: - cmd: 'jq .version ${{ env.package_json }} -r' + cmd: "jq .version ${{ env.package_json }} -r" - name: Extract electronVersion from package.json uses: sergeysova/jq-action@v2 @@ -57,22 +54,22 @@ jobs: uses: sergeysova/jq-action@v2 id: packageManager with: - cmd: "jq .packageManager ${{ env.package_json }} -r" + cmd: "jq .packageManager ${{ env.package_json }} -r" - name: Gather Release Information id: release_info run: | - echo "release_title=$(git show --format=%s --no-patch | head -1)" >> $GITHUB_OUTPUT - echo "release_version=$(TZ=Asia/Shanghai date +'v%Y%m%d%H%M')" >> $GITHUB_OUTPUT - changelog_header=$(python scripts/parse-changelog-HEAD.py -t ${{ github.ref }} -b ${{ steps.thisLatestRelease.outputs.release }} -e ${{ steps.electronVersion.outputs.value }} ${{ env.repo_owner }}/${{ env.repo_name }}) - changelog=$(python scripts/parse-changelog.py -t ${{ github.ref }} ${{ env.repo_owner }}/${{ env.repo_name }}) - EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - echo "release_body<<$EOF" >> $GITHUB_ENV - echo "$changelog_header" >> $GITHUB_ENV - echo "$changelog" >> $GITHUB_ENV - echo "$EOF" >> $GITHUB_ENV + echo "release_title=$(git show --format=%s --no-patch | head -1)" >> $GITHUB_OUTPUT + echo "release_version=$(TZ=Asia/Shanghai date +'v%Y%m%d%H%M')" >> $GITHUB_OUTPUT + changelog_header=$(python scripts/parse-changelog-HEAD.py -t ${{ github.ref }} -b ${{ steps.thisLatestRelease.outputs.release }} -e ${{ steps.electronVersion.outputs.value }} ${{ github.repository }}) + changelog=$(python scripts/parse-changelog.py -t ${{ github.ref }} ${{ github.repository }}) + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "release_body<<$EOF" >> $GITHUB_ENV + echo "$changelog_header" >> $GITHUB_ENV + echo "$changelog" >> $GITHUB_ENV + echo "$EOF" >> $GITHUB_ENV env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create Release id: create_release @@ -92,7 +89,7 @@ jobs: strategy: matrix: config: - - os: ubuntu-22.04 + - os: ubuntu-24.04 name: ubuntu build linux.AppImage kernel_path: "../app/kernel-linux/SiYuan-Kernel" build_args_prefix: "-s -w -X" @@ -101,7 +98,7 @@ jobs: goos: "linux" goarch: "amd64" suffix: "linux.AppImage" - - os: ubuntu-22.04 + - os: ubuntu-24.04 name: ubuntu build linux.tar.gz kernel_path: "../app/kernel-linux/SiYuan-Kernel" build_args_prefix: "-s -w -X" @@ -141,100 +138,100 @@ jobs: suffix: "win.exe" steps: - - uses: actions/checkout@v4 - with: - path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }} + - uses: actions/checkout@v6 + with: + path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} - - name: Set up MingGW - uses: msys2/setup-msys2@v2 - if: "contains( matrix.config.goos, 'windows')" - with: - install: p7zip mingw-w64-x86_64-lua + - name: Set up MingGW + uses: msys2/setup-msys2@v2 + if: "contains( matrix.config.goos, 'windows')" + with: + install: p7zip mingw-w64-x86_64-lua - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel/go.mod - - run: go version + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernel/go.mod + - run: go version - - name: Set up goversioninfo - run: go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo && go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo - if: "contains( matrix.config.goos, 'windows')" - working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel - env: - GO111MODULE: on - CGO_ENABLED: 1 - GOOS: ${{ matrix.config.goos }} - GOPATH: ${{ github.workspace }}/go - GOARCH: ${{ matrix.config.goarch }} + - name: Set up goversioninfo + run: go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo && go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo + if: "contains( matrix.config.goos, 'windows')" + working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernel + env: + GO111MODULE: on + CGO_ENABLED: 1 + GOOS: ${{ matrix.config.goos }} + GOPATH: ${{ github.workspace }}/go + GOARCH: ${{ matrix.config.goarch }} - - name: Set up Node - uses: actions/setup-node@v4 - with: - node-version: 20 + - name: Set up Node + uses: actions/setup-node@v6 + with: + node-version: 20 - - name: Install Node pnpm - run: npm install -g ${{ needs.create_release.outputs.packageManager }} - working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app + - name: Install Node pnpm + run: npm install -g ${{ needs.create_release.outputs.packageManager }} + working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app - - name: Install Node Dependencies - run: pnpm install --no-frozen-lockfile - working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app + - name: Install Node Dependencies + run: pnpm install --no-frozen-lockfile + working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app - - name: Building UI - run: pnpm run build - working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app + - name: Building UI + run: pnpm run build + working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app - - name: Remove Build Directory - uses: JesseTG/rm@v1.0.2 - with: - path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/build + - name: Remove Build Directory + uses: JesseTG/rm@v1.0.2 + with: + path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build - - name: Remove Kernel Directory for Linux - uses: JesseTG/rm@v1.0.2 - with: - path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/kernel-linux + - name: Remove Kernel Directory for Linux + uses: JesseTG/rm@v1.0.2 + with: + path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/kernel-linux - - name: Remove Kernel Directory for Windows - uses: JesseTG/rm@v1.0.2 - with: - path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/kernel + - name: Remove Kernel Directory for Windows + uses: JesseTG/rm@v1.0.2 + with: + path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/kernel - - name: Remove Kernel Directory for macOS - uses: JesseTG/rm@v1.0.2 - with: - path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/kernel-darwin + - name: Remove Kernel Directory for macOS + uses: JesseTG/rm@v1.0.2 + with: + path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/kernel-darwin - - name: Remove Kernel Directory for macOS ARM64 - uses: JesseTG/rm@v1.0.2 - with: - path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/kernel-darwin-arm64 + - name: Remove Kernel Directory for macOS ARM64 + uses: JesseTG/rm@v1.0.2 + with: + path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/kernel-darwin-arm64 - - name: Generate Icon Resource and Properties/Version Info For Windows - run: ${{ github.workspace }}\go\${{ matrix.config.gobin }}\goversioninfo -platform-specific=true -icon="resource\icon.ico" -manifest="resource\goversioninfo.exe.manifest" - if: "contains( matrix.config.goos, 'windows')" - working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel - - - name: Building Kernel - run: go build --tags fts5 -o "${{ matrix.config.kernel_path }}" -v -ldflags "${{ matrix.config.build_args_prefix }} github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel/util.${{ matrix.config.build_args_suffix }}" - working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/kernel - env: - GO111MODULE: on - CGO_ENABLED: 1 - GOOS: ${{ matrix.config.goos }} - GOPATH: ${{ github.workspace }}/go - GOARCH: ${{ matrix.config.goarch }} - - - name: Building Electron App - run: pnpm run ${{ matrix.config.electron_args }} - working-directory: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app + - name: Generate Icon Resource and Properties/Version Info For Windows + run: ${{ github.workspace }}\go\${{ matrix.config.gobin }}\goversioninfo -platform-specific=true -icon="resource\icon.ico" -manifest="resource\goversioninfo.exe.manifest" + if: "contains( matrix.config.goos, 'windows')" + working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernel - - name: Upload Release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_name: siyuan-${{ needs.create_release.outputs.release_version }}-${{ matrix.config.suffix }} - asset_path: ${{ github.workspace }}/go/src/github.com/${{ env.repo_owner }}/${{ env.repo_name }}/app/build/siyuan-${{ needs.create_release.outputs.version }}-${{ matrix.config.suffix }} - asset_content_type: application/octet-stream + - name: Building Kernel + run: go build --tags fts5 -o "${{ matrix.config.kernel_path }}" -v -ldflags "${{ matrix.config.build_args_prefix }} github.com/${{ github.repository }}/kernel/util.${{ matrix.config.build_args_suffix }}" + working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/kernel + env: + GO111MODULE: on + CGO_ENABLED: 1 + GOOS: ${{ matrix.config.goos }} + GOPATH: ${{ github.workspace }}/go + GOARCH: ${{ matrix.config.goarch }} + + - name: Building Electron App + run: pnpm run ${{ matrix.config.electron_args }} + working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app + + - name: Upload Release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_name: siyuan-${{ needs.create_release.outputs.release_version }}-${{ matrix.config.suffix }} + asset_path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/app/build/siyuan-${{ needs.create_release.outputs.version }}-${{ matrix.config.suffix }} + asset_content_type: application/octet-stream diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 3dde873d5..87ef33a80 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -13,9 +13,6 @@ on: # ref https://docs.github.com/zh/actions/learn-github-actions/variables env: - repo_name_android: "siyuan-android" - repo_name: "siyuan" - repo_owner: "siyuan-note" package_json: "app/package.json" docker_hub_owner: "b3log" docker_hub_repo: "siyuan" @@ -31,7 +28,7 @@ jobs: steps: - name: Checkout repository and submodules - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: ${{ github.event.ref }} submodules: recursive @@ -59,13 +56,13 @@ jobs: swap-storage: true - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + uses: docker/setup-qemu-action@v4 - name: Setup Docker buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Log in to Docker Hub - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: username: ${{ secrets.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_HUB_PWD }} diff --git a/scripts/parse-changelog-HEAD.py b/scripts/parse-changelog-HEAD.py index 50d50a231..e6ac0793f 100644 --- a/scripts/parse-changelog-HEAD.py +++ b/scripts/parse-changelog-HEAD.py @@ -11,7 +11,8 @@ def generate_msg_from_repo(repo_name, args): return None action_file = "cd.yml" - print(U.generate_header_from_repo(repo_name, args.tag, args.lastestRelease, args.electronVersion, action_file, C.HEADER[repo_name])) + header = C.HEADER.get(repo_name,"") + print(U.generate_header_from_repo(repo_name, args.tag, args.lastestRelease, args.electronVersion, action_file, header)) if __name__ == "__main__":