Skip to content

Commit

Permalink
Adding .exe extension in windows release
Browse files Browse the repository at this point in the history
Signed-off-by: Dusan Malusev <malusevd99@gmail.com>
  • Loading branch information
Dusan Malusev committed Apr 30, 2021
1 parent 2767446 commit dd1af94
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 37 deletions.
71 changes: 38 additions & 33 deletions .github/workflows/release.yml
Expand Up @@ -29,36 +29,41 @@ jobs:
runs-on: ${{ matrix.os }}
needs: release
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: olegtarasov/get-tag@v2.1
id: git_tag
with:
tagRegex: "v(.*)"
tagRegexGroup: 1
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: make test RACE=1 ENVIRONMENT=production
- name: Build
run: make build VERSION=${{ steps.git_tag.outputs.tag }} RACE=0 ENVIRONMENT=production
env:
CGO_ENABLED: 0
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./bin/hosts
asset_name: hosts-${{ matrix.os }}-${{ steps.git_tag.outputs.tag }}
asset_content_type: application/octet-stream
- name: Checkout
uses: actions/checkout@v2
- uses: olegtarasov/get-tag@v2.1
id: git_tag
with:
tagRegex: 'v(.*)'
tagRegexGroup: 1
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: make test RACE=1 ENVIRONMENT=production
- name: Build
run: |
if ["${{ matrix.os }}" = windows-latest]; then
make build VERSION=${{ steps.git_tag.outputs.tag }} RACE=0 ENVIRONMENT=production EXT=.exe;
else
make build VERSION=${{ steps.git_tag.outputs.tag }} RACE=0 ENVIRONMENT=production;
fi
env:
CGO_ENABLED: 0
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./bin/hosts
asset_name: hosts-${{ matrix.os }}-${{ steps.git_tag.outputs.tag }}
asset_content_type: application/octet-stream
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -2,6 +2,7 @@ GOPATH ?= ${HOME}/go
RACE ?= 0
ENVIRONMENT ?= development
VERSION ?= dev
EXT ?=

.PHONY: all
all: clean test build
Expand All @@ -17,7 +18,7 @@ endif
.PHONY: build
build:
ifeq ($(ENVIRONMENT),production)
CGO_ENABLED=0 go build -ldflags="-s -w -X 'main.Version=${VERSION}'" -o ./bin/hosts cmd/hosts/main.go
CGO_ENABLED=0 go build -ldflags="-s -w -X 'main.Version=${VERSION}'" -o ./bin/hosts$(EXT) cmd/hosts/main.go
else ifeq ($(ENVIRONMENT),development)
go build -o ./bin/hosts cmd/hosts/main.go
else
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -11,7 +11,7 @@ This program is designed for developers to help them manage host files, which th

# Installation

1. Download from [Releases page](https://github.com/BrosSquad/hosts/releases/tag/v2.0.2).
1. Download from [Releases page](https://github.com/BrosSquad/hosts/releases/tag/v2.0.3).


2. Building from Source
Expand All @@ -20,8 +20,8 @@ This program is designed for developers to help them manage host files, which th

```sh
$ git clone https://github.com/BrosSquad/hosts.git hosts && cd hosts
$ git checkout tags/v2.0.2 -b v2.0.2
$ make build VERSION=2.0.2 ENVIRONMENT=production RACE=0
$ git checkout tags/v2.0.3 -b v2.0.3
$ make build VERSION=2.0.3 ENVIRONMENT=production RACE=0
$ make install
```

Expand Down

0 comments on commit dd1af94

Please sign in to comment.