|
1 | 1 | name: Release |
2 | 2 |
|
3 | 3 | # Push a tag v<version> matching plugin.json to publish a GitHub Release. |
4 | | -# Lithe Store's tracker picks up stable releases and opens index pull requests. |
5 | | -# Tags listed in PRERELEASE_TAGS below are published as pre-releases, which the |
6 | | -# tracker skips until a compatible Lithe desktop release is out. |
| 4 | +# Lithe Store automatically tracks stable releases of eligible plugins. |
7 | 5 | on: |
8 | 6 | push: |
9 | 7 | tags: ["v*"] |
10 | 8 |
|
11 | 9 | permissions: |
12 | | - contents: write |
| 10 | + contents: read |
13 | 11 |
|
14 | 12 | jobs: |
15 | | - release: |
| 13 | + check: |
16 | 14 | runs-on: ubuntu-latest |
17 | | - timeout-minutes: 15 |
| 15 | + timeout-minutes: 5 |
| 16 | + outputs: |
| 17 | + exists: ${{ steps.release.outputs.exists }} |
18 | 18 | steps: |
19 | | - - name: Check whether release already exists |
20 | | - id: check |
| 19 | + - name: Check whether the release already exists |
| 20 | + id: release |
21 | 21 | env: |
22 | 22 | GH_TOKEN: ${{ github.token }} |
23 | 23 | run: | |
24 | 24 | if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then |
25 | | - echo "Release $GITHUB_REF_NAME already exists; skipping workflow build." |
26 | 25 | echo "exists=true" >> "$GITHUB_OUTPUT" |
27 | 26 | else |
28 | 27 | echo "exists=false" >> "$GITHUB_OUTPUT" |
29 | 28 | fi |
| 29 | +
|
| 30 | + package: |
| 31 | + needs: check |
| 32 | + if: needs.check.outputs.exists == 'false' |
| 33 | + uses: ./.github/workflows/package.yml |
| 34 | + with: |
| 35 | + tag: ${{ github.ref_name }} |
| 36 | + |
| 37 | + release: |
| 38 | + needs: [check, package] |
| 39 | + if: needs.check.outputs.exists == 'false' |
| 40 | + runs-on: ubuntu-latest |
| 41 | + timeout-minutes: 5 |
| 42 | + permissions: |
| 43 | + contents: write |
| 44 | + steps: |
30 | 45 | - uses: actions/checkout@v4 |
31 | | - if: steps.check.outputs.exists != 'true' |
32 | 46 | - uses: actions/setup-node@v4 |
33 | | - if: steps.check.outputs.exists != 'true' |
34 | 47 | with: |
35 | 48 | node-version: 22 |
36 | | - - name: Build 6 platform archives |
37 | | - if: steps.check.outputs.exists != 'true' |
38 | | - run: | |
39 | | - set -o pipefail |
40 | | - node scripts/package.mjs --expect-tag "$GITHUB_REF_NAME" | tee "$RUNNER_TEMP/checksums.txt" |
41 | | - - name: Verify release archives |
42 | | - if: steps.check.outputs.exists != 'true' |
| 49 | + - uses: actions/download-artifact@v4 |
| 50 | + with: |
| 51 | + pattern: python-support-archive-* |
| 52 | + merge-multiple: true |
| 53 | + path: dist |
| 54 | + - name: Verify the six release archives |
| 55 | + env: |
| 56 | + LITHE_EXPECT_ALL_ARCHIVES: "1" |
43 | 57 | run: node --test --test-timeout=60000 scripts/package/*.test.mjs |
44 | 58 | - name: Publish GitHub Release |
45 | | - if: steps.check.outputs.exists != 'true' |
46 | 59 | env: |
47 | 60 | GH_TOKEN: ${{ github.token }} |
48 | | - PRERELEASE_TAGS: v0.1.0 v0.1.1 |
| 61 | + # v1.0.0 requires a host that advertises toolchainProviders 0 and buildSystems 1. |
| 62 | + PRERELEASE_TAGS: v0.1.0 v0.1.1 v1.0.0 |
49 | 63 | run: | |
50 | | - prerelease=false |
| 64 | + release_flags=() |
| 65 | + installation='Lithe Store 会在收录后提供此版本。打开 设置 → 插件 → 插件市场,搜索 Python Support。' |
51 | 66 | for tag in $PRERELEASE_TAGS; do |
52 | | - if [[ "$tag" == "$GITHUB_REF_NAME" ]]; then prerelease=true; fi |
| 67 | + if [[ "$tag" == "$GITHUB_REF_NAME" ]]; then |
| 68 | + release_flags+=(--prerelease) |
| 69 | + installation='下载对应平台的 ZIP。打开 设置 → 插件 → 从文件安装…,核对 SHA-256 后确认。' |
| 70 | + break |
| 71 | + fi |
53 | 72 | done |
| 73 | + notes="docs/releases/$GITHUB_REF_NAME.md" |
| 74 | + test -s "$notes" |
54 | 75 | { |
55 | | - echo "兼容性:按插件契约 v0(schemaVersion 0、pluginAPIVersion 0)构建,需要支持声明式插件契约 v0 与项目内工具环境(.venv)信任解析的新版 Lithe 桌面端(desktop-v* 预发布)。" |
| 76 | + cat "$notes" |
56 | 77 | echo |
57 | | - if [[ -s "docs/releases/$GITHUB_REF_NAME.md" ]]; then |
58 | | - cat "docs/releases/$GITHUB_REF_NAME.md" |
59 | | - echo |
60 | | - fi |
61 | | - if [[ "$prerelease" == true ]]; then |
62 | | - echo "安装:预发布版本,Lithe Store 自动追踪会跳过。下载对应平台的 ZIP,在 设置 → 插件 中点击 从文件安装…,选中 ZIP 后核对 SHA-256 并确认。" |
63 | | - else |
64 | | - echo "安装:Lithe Store(https://github.com/Lithe-IDEA/Lithe-store)收录后,可在 设置 → 插件 → 插件市场 中搜索 Python Support 并安装。" |
65 | | - fi |
| 78 | + echo "$installation" |
| 79 | + echo |
| 80 | + echo 'SHA-256' |
66 | 81 | echo |
67 | | - echo "SHA-256:" |
68 | 82 | echo '```' |
69 | | - sed 's#^dist/##' "$RUNNER_TEMP/checksums.txt" |
| 83 | + (cd dist && sha256sum ./*.zip) |
70 | 84 | echo '```' |
71 | 85 | } > "$RUNNER_TEMP/notes.md" |
72 | | - release_flags=() |
73 | | - if [[ "$prerelease" == true ]]; then |
74 | | - release_flags+=(--prerelease) |
75 | | - fi |
76 | 86 | gh release create "$GITHUB_REF_NAME" dist/*.zip --title "Python Support $GITHUB_REF_NAME" --notes-file "$RUNNER_TEMP/notes.md" "${release_flags[@]}" |
0 commit comments