diff --git a/.github/workflows/go-release.yml b/.github/workflows/go-release.yml new file mode 100644 index 0000000..da101dc --- /dev/null +++ b/.github/workflows/go-release.yml @@ -0,0 +1,64 @@ +name: Go Release +on: + push: + tags: + - 'v*' +jobs: + release-binary: + name: Release Binary + runs-on: ubuntu-latest + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: '^1.18' + + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + + - name: Cache go module + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Get dependencies and run test + run: | + go test ./... + + - name: Build + if: startsWith(github.ref, 'refs/tags/') + env: + NAME: nali + BINDIR: bin + run: make -j releases && make sha256sum + + - name: Upload Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: bin/* + draft: true + prerelease: true + + - uses: actions/upload-artifact@v3 + if: startsWith(github.ref, 'refs/tags/') + with: + name: build + path: bin + + release-aur: + name: Release Aur + runs-on: ubuntu-latest + steps: + - name: Publish AUR package + uses: guumaster/aur-publish-docker-action@v1 + with: + package_name: nali-go + commit_username: 'zu1k' + commit_email: 'i@zu1k.com' + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f535d3e..ad5091c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -27,24 +27,4 @@ jobs: go test ./... - name: Build - if: startsWith(github.ref, 'refs/tags/') - env: - NAME: nali - BINDIR: bin - run: make -j releases && make sha256sum - - - name: Upload Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - files: bin/* - draft: true - prerelease: true - - - uses: actions/upload-artifact@v3 - if: startsWith(github.ref, 'refs/tags/') - with: - name: build - path: bin + run: go build diff --git a/Makefile b/Makefile index bf3b77f..6eac396 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,7 @@ NAME=nali BINDIR=bin VERSION=$(shell git describe --tags || echo "unknown version") -BUILDTIME=$(shell date -u) -GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/zu1k/nali/internal/constant.Version=$(VERSION)" \ - -X "github.com/zu1k/nali/internal/constant.BuildTime=$(BUILDTIME)" \ - -w -s' +GOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags '-X "github.com/zu1k/nali/internal/constant.Version=$(VERSION)" -w -s' PLATFORM_LIST = \ darwin-arm64 \ diff --git a/internal/constant/version.go b/internal/constant/version.go index 77a8762..7af1c7e 100644 --- a/internal/constant/version.go +++ b/internal/constant/version.go @@ -3,6 +3,4 @@ package constant var ( // Version like 1.0.1 Version = "unknown version" - // BuildTime like 2020-01-01 - BuildTime = "unknown time" )