累积策略更新并调整发布策略 (#23) #30
This file contains 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: Publisher | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
publish: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
node-version: [ 20.x ] | |
env: | |
CONFIG: Release | |
steps: | |
- name: 检出代码 | |
uses: actions/checkout@v3 | |
- name: 获取发布信息 | |
run: | | |
echo "PUBLISH_VERSION=$(Get-Date -Format 'yyyy.MM.dd.HHmm')" >> $env:GITHUB_ENV | |
echo "PUBLISH_DATETIME=$(Get-Date -Format 'yyyy.MM.dd HH:mm:ss')" >> $env:GITHUB_ENV | |
echo "EDGE_POLICY_VERSION=$(Get-Content ./StaticModels/Policy/SUPPORT_VERSION)" >> $env:GITHUB_ENV | |
- name: 获取提交信息 | |
run: | | |
echo "COMMIT_TITLE=$(git log -1 --pretty=format:'%s')" >> $GITHUB_ENV | |
commit_body=$(git log -1 --pretty=format:"%b" | sed -E 's/^([^ ]+) (.+)$/* `\1` \2/') | |
{ | |
echo 'COMMIT_BODY<<EOF' | |
echo "$commit_body" | |
echo EOF | |
} >> "$GITHUB_ENV" | |
shell: bash | |
- name: 修改版本号 | |
run: | | |
npm i fast-xml-parser | |
node .github/workflows/edit_version.mjs | |
- name: 克隆完整仓库 | |
run: | | |
git fetch --unshallow | |
- name: 优化 Gitee 连接 | |
run: | | |
echo 182.255.33.134 gitee.com >> C:\Windows\System32\drivers\etc\hosts | |
ipconfig /flushdns | |
- name: 同步分支到 Gitee | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 3 | |
command: | | |
git fetch --unshallow | |
git push -f "https://NXY666:$env:[email protected]/NXY666/EdgePolicyManager.git" | |
env: | |
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }} | |
- name: 安装 .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: 发布软件包 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITEE_TOKEN: ${{ secrets.GITEE_TOKEN }} | |
run: | | |
npm i @actions/github @octokit/rest | |
node .github/workflows/create_release.mjs |