From ee6d7bc59390a75e07429d6de0cbb09c7d2f54da Mon Sep 17 00:00:00 2001 From: Marco Argentieri <3596602+tiero@users.noreply.github.com> Date: Tue, 23 Mar 2021 19:57:38 +0100 Subject: [PATCH] gh action (#115) * GH Action for release on tag * scripts/build: remove CGO_ENABLED --- .github/workflows/release.yml | 42 +++++++++++++++++++++++++++++++++++ scripts/build | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..effc29f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,42 @@ +name: goreleaser + +on: + push: + tags: + - "*" +jobs: + goreleaser: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15.x + + - name: Cache Go modules + uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Docker Login + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist --debug + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/scripts/build b/scripts/build index 72616b9..a42b977 100755 --- a/scripts/build +++ b/scripts/build @@ -12,5 +12,5 @@ ARCH=$(eval "go env GOARCH") pushd $PARENT_PATH mkdir -p build -GO111MODULE=on CGO_ENABLED=1 go build -ldflags="-s -w" -o build/nigiri-$OS-$ARCH cli/main.go +GO111MODULE=on go build -ldflags="-s -w" -o build/nigiri-$OS-$ARCH cli/main.go popd