docs: 部署流程补充 OpenLiteWaf submodule 初始化说明 #61
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 | |
| # 当提交信息以 [Build] 开头时(或手动触发),发布 GitHub Release, | |
| # Release notes 取自 CHANGELOG.md 最新版本条目,tag 取自该条目的版本号。 | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| check-commit: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_release: ${{ steps.check.outputs.should_release }} | |
| steps: | |
| - id: check | |
| env: | |
| # commit message 由 push 者完全控制,直接用 ${{ }} 插值进 run 脚本 | |
| # 会构成 GitHub Actions 脚本注入(runner 上任意命令执行),必须经 | |
| # 环境变量中转后按普通 shell 变量使用 | |
| HEAD_MSG: ${{ github.event.head_commit.message }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| run: | | |
| if [ "$EVENT_NAME" = "workflow_dispatch" ]; then | |
| echo "should_release=true" >> "$GITHUB_OUTPUT" | |
| elif [[ "$HEAD_MSG" == "[Build]"* ]]; then | |
| echo "should_release=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "should_release=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| release: | |
| needs: check-commit | |
| if: needs.check-commit.outputs.should_release == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate release metadata | |
| id: meta | |
| shell: bash | |
| run: | | |
| VER=$(grep -m1 '^## ' CHANGELOG.md | sed 's/^## //; s/ .*//') | |
| echo "tag=v${VER}" >> "$GITHUB_OUTPUT" | |
| awk 'BEGIN{s=0} /^## /{if(s) exit; s=1; next} s{print}' CHANGELOG.md > RELEASE_NOTES.md | |
| echo "tag=v${VER}" | |
| head -n 5 RELEASE_NOTES.md | |
| - name: Publish release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.meta.outputs.tag }} | |
| name: LogShare ${{ steps.meta.outputs.tag }} | |
| body_path: RELEASE_NOTES.md |