From e557a6ebbcec5b0738e77fbde1463f00551e334c Mon Sep 17 00:00:00 2001 From: qingfeng Date: Fri, 15 Dec 2023 16:19:52 +0800 Subject: [PATCH] Add GH release action --- .github/workflows/2-release.yml | 30 ++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/2-release.yml diff --git a/.github/workflows/2-release.yml b/.github/workflows/2-release.yml new file mode 100644 index 0000000..54cf500 --- /dev/null +++ b/.github/workflows/2-release.yml @@ -0,0 +1,30 @@ +name: Release + +on: + push: + tags: + - v* + +jobs: + relese: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: 1.21.x + - name: Install dependencies + run: go get . + - name: Run test + run: make test + - name: Build binary + run: make build-all + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + out/mailman-linux-amd64 + out/mailman-linux-arm + out/mailman-darwin-amd64 + out/mailman-windows-amd64.exe diff --git a/Makefile b/Makefile index b83504b..e782e59 100644 --- a/Makefile +++ b/Makefile @@ -23,4 +23,4 @@ build-all: fmt generate GOOS=linux GOARCH=amd64 go build -ldflags "-w -s -X main.version=${VERSION}" -o out/mailman-linux-amd64 main.go && \ GOOS=linux GOARCH=arm go build -ldflags "-w -s -X main.version=${VERSION}" -o out/mailman-linux-arm main.go && \ GOOS=darwin GOARCH=amd64 go build -ldflags "-w -s -X main.version=${VERSION}" -o out/mailman-darwin-amd64 main.go && \ - GOOS=windows GOARCH=amd64 go build -ldflags "-w -s -X main.version=${VERSION}" -o out/mailman-windows-amd64.exe main.go && \ + GOOS=windows GOARCH=amd64 go build -ldflags "-w -s -X main.version=${VERSION}" -o out/mailman-windows-amd64.exe main.go