Update README.md #108
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: Build | |
on: | |
push | |
jobs: | |
gen-new-release-item: | |
if: startsWith(github.ref, 'refs/tags/') #在打tag时候触发 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set timezone | |
uses: szenius/set-timezone@v1.2 | |
with: | |
timezoneLinux: "Asia/Shanghai" | |
timezoneMacos: "Asia/Shanghai" | |
timezoneWindows: "China Standard Time" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: gen changelog | |
id: changelog | |
uses: mikepenz/release-changelog-builder-action@v4.0.0-rc06 | |
with: | |
configurationJson: | | |
{ | |
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>未归类</summary>\n\n#{{UNCATEGORIZED}}\n</details>", | |
"pr_template": "- ##{{NUMBER}} #{{TITLE}} by @#{{AUTHOR}}", | |
"categories": [ | |
{ | |
"title": "## 🚀 功能", | |
"labels": ["feature"], | |
"empty_content": "- 未有相关功能类 PR." | |
}, | |
{ | |
"title": "## 🐛 修复", | |
"labels": ["fix"], | |
"empty_content": "- 未有相关修复类 PR." | |
}, | |
{ | |
"title": "## 💬 其他", | |
"labels": ["documentation", "other"], | |
"exhaustive": false | |
} | |
], | |
"base_branches": [ | |
"neo" | |
] | |
} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ngapost2md ver.[NEO_${{ github.ref }}] | |
body: ${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
release-matrix: | |
needs: gen-new-release-item | |
if: startsWith(github.ref, 'refs/tags/') #在打tag时候触发 | |
name: release binary | |
env: | |
commitmsg: ${{ github.event.head_commit.message }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: ["386",amd64, arm64] | |
exclude: | |
- goarch: arm64 | |
goos: windows | |
- goarch: "386" | |
goos: windows | |
- goarch: "386" | |
goos: darwin | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get tag | |
id: tag | |
uses: devops-actions/action-get-tag@v1.0.1 | |
with: | |
strip_v: true # Optional: Remove 'v' character from version | |
default: v0.0.0 # Optional: Default version when tag not found | |
- name: Set BUILD_TS env | |
run: echo BUILD_TS=$(date +%s) >> ${GITHUB_ENV} | |
- name: Environment Printer | |
uses: managedkaos/print-env@v1.0 | |
- uses: wangyoucao577/go-release-action@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
release_tag: ${{steps.tag.outputs.tag}} | |
goos: ${{ matrix.goos }} | |
goarch: ${{ matrix.goarch }} | |
goversion: 1.21.0 | |
md5sum: FALSE | |
extra_files: LICENSE README.md assets/* #将这些文件一并打包 | |
ldflags: -X "github.com/ludoux/ngapost2md/nga.DEBUG_MODE=0" -X "github.com/ludoux/ngapost2md/nga.BUILD_TS=${{ env.BUILD_TS }}" -X github.com/ludoux/ngapost2md/nga.GIT_REF=${{ github.ref }} -X github.com/ludoux/ngapost2md/nga.GIT_HASH=${{ github.sha }} | |
overwrite: TRUE #若已有附件则覆写 | |
asset_name: ngapost2md-NEO_${{ steps.tag.outputs.tag }}-${{ matrix.goos }}-${{ matrix.goarch }} |