Skip to content

Commit

Permalink
Add action for automation build binaries and release (#6)
Browse files Browse the repository at this point in the history
* Add release.yml, build on windows, macos, linux

* README, add mac os support.
  • Loading branch information
v-kamerdinerov authored Aug 7, 2024
1 parent bd423ea commit 7dce6f9
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 2 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
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 }}/*
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ It is recommended to run this scanner locally _(with your residential internet)_

## Run

### Linux:
### Linux/Mac OS:

Be careful when choosing an architecture, all binaries are available in two versions - `amd64` and `arm64`.

1.
```
wget "https://github.com/hawshemi/SNI-Finder/releases/latest/download/SNI-Finder-linux-amd64" -O SNI-Finder && chmod +x SNI-Finder
wget "https://github.com/hawshemi/SNI-Finder/releases/latest/download/SNI-Finder-$(uname -s | tr A-Z a-z)-amd64" -O SNI-Finder && chmod +x SNI-Finder
```
2.
```
Expand Down

0 comments on commit 7dce6f9

Please sign in to comment.