summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-09-10 17:58:35 +0800
committerKeuin <[email protected]>2022-09-10 17:58:35 +0800
commit5664705557ad5e4a3bd1234b12e4054a1a9579c1 (patch)
treece2c9f1124dcaf66c7bd1093b6bb604b2830e93d
parenta1eef71e0f092ccc7be89b434eaee08ec98eea41 (diff)
Update GitHub actions.v0.1.0
-rw-r--r--.github/workflows/create-release.yml48
1 files changed, 21 insertions, 27 deletions
diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
index 3171047..4702e59 100644
--- a/.github/workflows/create-release.yml
+++ b/.github/workflows/create-release.yml
@@ -9,7 +9,7 @@ name: Create Release
jobs:
build:
- name: Create Release
+ name: Build binary files
# START build targets
strategy:
@@ -107,36 +107,30 @@ jobs:
- name: Get project dependencies
run: go mod download
- - name: Set asset filename for non-Windows OSes
- if: matrix.goos != 'windows'
- run: echo "ASSET_NAME=$GOOS-$GOARCH$GOARM" >> $GITHUB_ENV
-
- - name: Set asset filename for Windows
+ - name: Add exe extname for Windows
if: matrix.goos == 'windows'
- run: echo "ASSET_NAME=$GOOS-$GOARCH$GOARM.exe" >> $GITHUB_ENV
+ run: echo "ASSET_EXT_NAME=.exe" >> $GITHUB_ENV
+
+ - name: Rename GOARCH (rename "386" to "i386")
+ if: matrix.goarch == '386'
+ run: echo "ARCH_NAME=i386" >> $GITHUB_ENV
+
+ - name: Rename GOARCH (NOP)
+ if: matrix.goarch != '386'
+ run: echo "ARCH_NAME=${GOARCH}${GOARM}" >> $GITHUB_ENV
+
+ - name: Set asset filename
+ run: echo "ASSET_NAME=slbr_${GOOS}_${ARCH_NAME}${ASSET_EXT_NAME}" >> $GITHUB_ENV
- name: Build binaries
run: |
mkdir -p build_assets
- go build -v -o build_assets/$ASSET_NAME -trimpath
-
- - name: Create Release
- id: create_release
- uses: actions/create-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
- with:
- tag_name: ${{ github.ref }}
- release_name: Release ${{ github.ref }}
- prerelease: true
+ go build -v -o build_assets/$ASSET_NAME -trimpath -ldflags="-s -w"
- - name: Upload binary file to release
- id: upload-release-asset
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Upload binaries to release
+ uses: svenstaro/upload-release-action@v2
with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: ./build_assets/$ASSET_NAME
- asset_name: $ASSET_NAME
- asset_content_type: application/octet-stream \ No newline at end of file
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file_glob: true
+ file: build_assets/*
+ tag: ${{ github.ref }} \ No newline at end of file