diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..48a358a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,63 @@ +name: Build Binaries + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + repository-projects: write + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: '0' + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Ensure Dependencies + run: | + go mod tidy + + - name: Build Binary + working-directory: ./ + run: | + make build-static + # - name: Create Git Tag + # run: | + # git tag v1.0.0 + # git push https://x-access-token:${{ secrets.GH_PAT }}@github.com/strangelove-ventures/bech32cli.git v1.0.0 + + - name: Upload AMD64 Binary as Artifact + uses: actions/upload-artifact@v4 + with: + name: bech32-amd64 + path: build/bech32-amd64 + + - name: Upload ARM64 Binary as Artifact + uses: actions/upload-artifact@v4 + with: + name: bech32-arm64 + path: build/bech32-arm64 + + - name: Create GitHub Release + id: create_release + uses: anothrNick/github-tag-action@v1 + with: + files: | + build/bech32-amd64 + build/bech32-arm64 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WITH_V: false diff --git a/Makefile b/Makefile index 20e5ae7..2730eaa 100644 --- a/Makefile +++ b/Makefile @@ -26,10 +26,10 @@ build-static: build-static-amd64 build-static-arm64 build-static-amd64: @echo "building bech32 amd64 static binary..." - @GOOS=linux GOARCH=amd64 go build -mod=readonly -o build/bech32-amd64 -a -tags netgo -ldflags '$(ldflags) -extldflags "-static"' . + @GOOS=linux GOARCH=amd64 go build -o build/bech32-amd64 -a -tags netgo -ldflags '$(ldflags) -extldflags "-static"' . build-static-arm64: @echo "building bech32 arm64 static binary..." - @GOOS=linux GOARCH=arm64 go build -mod=readonly -o build/bech32-arm64 -a -tags netgo -ldflags '$(ldflags) -extldflags "-static"' . + @GOOS=linux GOARCH=arm64 go build -o build/bech32-arm64 -a -tags netgo -ldflags '$(ldflags) -extldflags "-static"' . .PHONY: all build build-static-amd64 build-static-arm64 \ No newline at end of file