diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6726f7e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + tags: + - "v*" + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Build + run: | + go mod download + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gokins-linux-amd64 main.go + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o gokins-darwin-amd64 main.go + + - name: Get version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Create Release + run: | + hub release create -m "Gokins ${{ steps.get_version.outputs.VERSION }}" \ + -a gokins-linux-amd64 \ + -a gokins-darwin-amd64 \ + ${{ steps.get_version.outputs.VERSION }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}