From ed5106f3b68c89abeb79f2d8c4a797f110626c40 Mon Sep 17 00:00:00 2001 From: Lu Chang Date: Fri, 26 May 2023 23:56:33 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BD=BF=E7=94=A8=20Actions=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=89=93=E5=8C=85=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 70 ++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..d51b6d4 --- /dev/null +++ b/.github/workflows/build.yaml @@ -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/changelog-generator@v4.1.0 + 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/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 + + - 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 #若已有附件则覆写 \ No newline at end of file