Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create github actions for binary release #6

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading