Skip to content

Commit dd1af94

Browse files
author
Dusan Malusev
committed
Adding .exe extension in windows release
Signed-off-by: Dusan Malusev <[email protected]>
1 parent 2767446 commit dd1af94

File tree

3 files changed

+43
-37
lines changed

3 files changed

+43
-37
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,41 @@ jobs:
2929
runs-on: ${{ matrix.os }}
3030
needs: release
3131
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v2
34-
- uses: olegtarasov/[email protected]
35-
id: git_tag
36-
with:
37-
tagRegex: "v(.*)"
38-
tagRegexGroup: 1
39-
- name: Install Go
40-
uses: actions/setup-go@v2
41-
with:
42-
go-version: 1.16.x
43-
- uses: actions/cache@v2
44-
with:
45-
path: ~/go/pkg/mod
46-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
47-
restore-keys: |
48-
${{ runner.os }}-go-
49-
- name: Test
50-
run: make test RACE=1 ENVIRONMENT=production
51-
- name: Build
52-
run: make build VERSION=${{ steps.git_tag.outputs.tag }} RACE=0 ENVIRONMENT=production
53-
env:
54-
CGO_ENABLED: 0
55-
- name: Upload Release Asset
56-
id: upload-release-asset
57-
uses: actions/upload-release-asset@v1
58-
env:
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60-
with:
61-
upload_url: ${{ needs.release.outputs.upload_url }}
62-
asset_path: ./bin/hosts
63-
asset_name: hosts-${{ matrix.os }}-${{ steps.git_tag.outputs.tag }}
64-
asset_content_type: application/octet-stream
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
- uses: olegtarasov/[email protected]
35+
id: git_tag
36+
with:
37+
tagRegex: 'v(.*)'
38+
tagRegexGroup: 1
39+
- name: Install Go
40+
uses: actions/setup-go@v2
41+
with:
42+
go-version: 1.16.x
43+
- uses: actions/cache@v2
44+
with:
45+
path: ~/go/pkg/mod
46+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
47+
restore-keys: |
48+
${{ runner.os }}-go-
49+
- name: Test
50+
run: make test RACE=1 ENVIRONMENT=production
51+
- name: Build
52+
run: |
53+
if ["${{ matrix.os }}" = windows-latest]; then
54+
make build VERSION=${{ steps.git_tag.outputs.tag }} RACE=0 ENVIRONMENT=production EXT=.exe;
55+
else
56+
make build VERSION=${{ steps.git_tag.outputs.tag }} RACE=0 ENVIRONMENT=production;
57+
fi
58+
env:
59+
CGO_ENABLED: 0
60+
- name: Upload Release Asset
61+
id: upload-release-asset
62+
uses: actions/upload-release-asset@v1
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
with:
66+
upload_url: ${{ needs.release.outputs.upload_url }}
67+
asset_path: ./bin/hosts
68+
asset_name: hosts-${{ matrix.os }}-${{ steps.git_tag.outputs.tag }}
69+
asset_content_type: application/octet-stream

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ GOPATH ?= ${HOME}/go
22
RACE ?= 0
33
ENVIRONMENT ?= development
44
VERSION ?= dev
5+
EXT ?=
56

67
.PHONY: all
78
all: clean test build
@@ -17,7 +18,7 @@ endif
1718
.PHONY: build
1819
build:
1920
ifeq ($(ENVIRONMENT),production)
20-
CGO_ENABLED=0 go build -ldflags="-s -w -X 'main.Version=${VERSION}'" -o ./bin/hosts cmd/hosts/main.go
21+
CGO_ENABLED=0 go build -ldflags="-s -w -X 'main.Version=${VERSION}'" -o ./bin/hosts$(EXT) cmd/hosts/main.go
2122
else ifeq ($(ENVIRONMENT),development)
2223
go build -o ./bin/hosts cmd/hosts/main.go
2324
else

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This program is designed for developers to help them manage host files, which th
1111

1212
# Installation
1313

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

1616

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

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

0 commit comments

Comments
 (0)