-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Build | ||
on: | ||
push | ||
|
||
jobs: | ||
gen-new-release-item: | ||
if: startsWith(github.ref, 'refs/tags/') #在打tag时候触发 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: gen changelog | ||
id: changelog | ||
uses: metcalfc/[email protected] | ||
with: | ||
myToken: ${{ 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/[email protected] | ||
with: | ||
strip_v: true # Optional: Remove 'v' character from version | ||
default: v0.0.0 # Optional: Default version when tag not found | ||
|
||
- uses: wangyoucao577/go-release-action@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
release_tag: ${{steps.tag.outputs.tag}} | ||
goos: ${{ matrix.goos }} | ||
goarch: ${{ matrix.goarch }} | ||
md5sum: FALSE | ||
extra_files: LICENSE README.md assets/* #将这些文件一并打包 | ||
ldflags: -X github.com/ludoux/ngapost2md/nga.DEBUG_MODE=0 | ||
overwrite: TRUE #若已有附件则覆写 |
ed5106f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要打包时,对指定 commit 附加 tag (如
1.0.1
)并push到远端,即可触发此 GitHub Actions。此GitHub Actions 会自动发布新的 Releases 条目和附件。需要注意nga.go
内的VERSION
是需要手动修改的。