-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action for automation build binaries and release (#6)
* Add release.yml, build on windows, macos, linux * README, add mac os support.
- Loading branch information
1 parent
bd423ea
commit 7dce6f9
Showing
2 changed files
with
86 additions
and
2 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,82 @@ | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
env: | ||
BIN_PATH: /tmp/bin | ||
|
||
jobs: | ||
build: | ||
name: Build binaries | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
arch: [amd64, arm64] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21' | ||
cache: false | ||
|
||
- name: Run go mod tidy | ||
run: go mod tidy | ||
|
||
- name: Set environment variables | ||
run: | | ||
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then | ||
echo "GOOS=linux" >> $GITHUB_ENV | ||
elif [ "${{ matrix.os }}" == "macos-latest" ]; then | ||
echo "GOOS=darwin" >> $GITHUB_ENV | ||
else | ||
echo "GOOS=windows" >> $GITHUB_ENV | ||
echo "EXT=.exe" >> $GITHUB_ENV | ||
fi | ||
- name: Build binary | ||
env: | ||
GOARCH: ${{ matrix.arch }} | ||
GOOS: ${{ env.GOOS }} | ||
EXT: ${{ env.EXT }} | ||
run: | | ||
go build -o SNI-Finder-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} . | ||
- name: Upload binaries | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: SNI-Finder-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} | ||
path: SNI-Finder-${{ env.GOOS }}-${{ matrix.arch }}${{ env.EXT }} | ||
|
||
release: | ||
name: Create GitHub Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Create bin directory | ||
run: | | ||
mkdir -p ${{ env.BIN_PATH }} | ||
- name: Download binaries | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ${{ env.BIN_PATH }} | ||
pattern: SNI-Finder-* | ||
merge-multiple: true | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R ${{ env.BIN_PATH }} | ||
|
||
- name: Release with assets | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
files: ${{ env.BIN_PATH }}/* |
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