diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c368bb6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - goos: linux + goarch: amd64 + - goos: linux + goarch: arm64 + - goos: darwin + goarch: amd64 + - goos: darwin + goarch: arm64 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Build + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + run: | + go build \ + -ldflags "-X main.version=${{ github.ref_name }}" \ + -o terdut-tui-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} \ + . + + - uses: actions/upload-artifact@v4 + with: + name: terdut-tui-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} + path: terdut-tui-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }} + + release: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + merge-multiple: true + + - uses: softprops/action-gh-release@v2 + with: + files: 'terdut-tui-*' diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..46cfd8a --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +VERSION := $(shell git describe --tags --always --dirty) + +.PHONY: build install test + +build: + go build -ldflags "-X main.version=$(VERSION)" -o terdut-tui . + +install: + go install -ldflags "-X main.version=$(VERSION)" . + +test: + go test ./...