test_release.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: 【测试】自动发行版本
  2. on:
  3. workflow_dispatch:
  4. # push:
  5. # branches:
  6. # - master
  7. jobs:
  8. test-release:
  9. runs-on: ubuntu-latest
  10. permissions:
  11. contents: write
  12. pages: write
  13. id-token: write
  14. name: 【测试】发行新版本的发行
  15. steps:
  16. - name: 检出代码
  17. uses: actions/checkout@v4
  18. with:
  19. fetch-depth: 0
  20. - name: 检查版本
  21. id: version-check
  22. run: |
  23. VERSION=$(./scripts/is-newer-version.bash)
  24. echo "version=${VERSION}" >> $GITHUB_OUTPUT
  25. if [ "$VERSION" != "0" ]; then
  26. echo "检测到新版本: $VERSION"
  27. else
  28. echo "没有新版本需要发行"
  29. fi
  30. # - name: 推送标签
  31. # if: steps.version-check.outputs.version != '0'
  32. # id: push-tag
  33. # run: |
  34. # tag="v${{ steps.version-check.outputs.version }}"
  35. # git config user.name "${GITHUB_ACTOR}"
  36. # git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
  37. # git tag -a "${tag}" -m "Release ${tag}"
  38. # git push origin "${tag}"
  39. # echo "tag_name=${tag}" >> $GITHUB_OUTPUT
  40. - name: 配置环境
  41. if: steps.version-check.outputs.version != '0'
  42. run: |
  43. # 安装 Python 依赖
  44. python3 -m pip install --upgrade pip
  45. pip3 install -r requirements.txt
  46. # 安装构建依赖
  47. sudo apt-get update
  48. sudo apt-get install -y build-essential wget tar gzip
  49. - name: 编译字体
  50. if: steps.version-check.outputs.version != '0'
  51. run: |
  52. # 运行构建脚本
  53. bash build.bash
  54. - name: Upload artifact
  55. if: (cancelled() || failure() || success())
  56. uses: actions/upload-artifact@v4
  57. with:
  58. path: output/*
  59. compression-level: 9 # maximum compression
  60. retention-days: 5
  61. # - name: 创建 GitHub Release
  62. # if: steps.version-check.outputs.version != '0'
  63. # uses: ncipollo/release-action@v1
  64. # with:
  65. # generateReleaseNotes: true
  66. # tag: "v${{ steps.version-check.outputs.version }}"
  67. # artifacts: "output/*"
  68. # - name: 删除标签(如果失败)
  69. # if: (cancelled() || failure()) && steps.push-tag.outputs.tag_name != ''
  70. # run: |
  71. # git config user.name "${GITHUB_ACTOR}"
  72. # git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
  73. # git push --delete origin "${{ steps.push-tag.outputs.tag_name }}"
  74. # git tag -d "${{ steps.push-tag.outputs.tag_name }}"