1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-04 19:17:37 +08:00

ci: use commit sha version

This commit is contained in:
wdvxdr 2021-12-08 22:32:27 +08:00
parent c61de34732
commit 8ba93cbf7c
No known key found for this signature in database
GPG Key ID: 703F8C071DE7A1B6

View File

@ -5,8 +5,8 @@ on: [push, pull_request,workflow_dispatch]
env: env:
BINARY_PREFIX: "go-cqhttp_" BINARY_PREFIX: "go-cqhttp_"
BINARY_SUFFIX: "" BINARY_SUFFIX: ""
COMMIT_ID: "${{ github.sha }}"
PR_PROMPT: "::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request." PR_PROMPT: "::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request."
LD_FLAGS: "-w -s"
jobs: jobs:
build: build:
@ -46,7 +46,7 @@ jobs:
if $IS_PR ; then echo $PR_PROMPT; fi if $IS_PR ; then echo $PR_PROMPT; fi
export BINARY_NAME="$BINARY_PREFIX$GOOS_$GOARCH$BINARY_SUFFIX" export BINARY_NAME="$BINARY_PREFIX$GOOS_$GOARCH$BINARY_SUFFIX"
export CGO_ENABLED=0 export CGO_ENABLED=0
go build -o "output/$BINARY_NAME" -trimpath -ldflags "$LD_FLAGS" . go build -o "output/$BINARY_NAME" -trimpath -ldflags "-w -s -X main.version=${COMMIT_ID::7}" .
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
if: ${{ !github.head_ref }} if: ${{ !github.head_ref }}