Skip to content

Commit 95278df

Browse files
authored
Automate binary releases (#437)
* Add release assets automation * Use single module with local replace for examples * Update CHANGELOG.md * Allow expected failure for custom formatter example test * Set version value with ldflags * Restore artifacts cleanup
1 parent 1dcc44f commit 95278df

File tree

19 files changed

+110
-1380
lines changed

19 files changed

+110
-1380
lines changed

.github/workflows/release-assets.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This script uploads application binaries as GitHub release assets.
2+
name: release-assets
3+
on:
4+
release:
5+
types:
6+
- created
7+
env:
8+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9+
10+
jobs:
11+
build:
12+
name: Upload Release Assets
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Install Go
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: 1.17.x
19+
- name: Checkout code
20+
uses: actions/checkout@v2
21+
- name: Build artifacts
22+
run: |
23+
make artifacts
24+
- name: Upload linux amd64 binary
25+
uses: actions/upload-release-asset@v1
26+
with:
27+
upload_url: ${{ github.event.release.upload_url }}
28+
asset_path: ./_artifacts/godog-${{ github.event.release.tag_name }}-linux-amd64.tar.gz
29+
asset_name: godog-${{ github.event.release.tag_name }}-linux-amd64.tar.gz
30+
asset_content_type: application/tar+gzip
31+
- name: Upload linux arm64 binary
32+
uses: actions/upload-release-asset@v1
33+
with:
34+
upload_url: ${{ github.event.release.upload_url }}
35+
asset_path: ./_artifacts/godog-${{ github.event.release.tag_name }}-linux-arm64.tar.gz
36+
asset_name: godog-${{ github.event.release.tag_name }}-linux-arm64.tar.gz
37+
asset_content_type: application/tar+gzip
38+
- name: Upload darwin amd64 binary
39+
uses: actions/upload-release-asset@v1
40+
with:
41+
upload_url: ${{ github.event.release.upload_url }}
42+
asset_path: ./_artifacts/godog-${{ github.event.release.tag_name }}-darwin-amd64.tar.gz
43+
asset_name: godog-${{ github.event.release.tag_name }}-darwin-amd64.tar.gz
44+
asset_content_type: application/tar+gzip

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
1010

1111
## [Unreleased]
1212

13+
### Added
14+
15+
- Automated binary releases with GitHub Actions ([437](https://github.com/cucumber/godog/pull/437) - [vearutop])
16+
- Automated binary versioning with `go install` ([437](https://github.com/cucumber/godog/pull/437) - [vearutop])
17+
- Module with local replace in examples ([437](https://github.com/cucumber/godog/pull/437) - [vearutop])
18+
1319
### Changed
1420

1521
- suggest to use `go install` instead of the deprecated `go get` to install the `godog` binary ([449](https://github.com/cucumber/godog/pull/449) - [dmitris](https://github.com/dmitris))

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: test gherkin bump cover
22

3-
VERS := $(shell grep 'const Version' -m 1 godog.go | awk -F\" '{print $$2}')
3+
VERS ?= $(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
44

55
FOUND_GO_VERSION := $(shell go version)
66
EXPECTED_GO_VERSION = 1.17
@@ -58,7 +58,7 @@ artifacts:
5858

5959
define _build
6060
mkdir $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2
61-
env GOOS=$1 GOARCH=$2 go build -o $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/godog ./cmd/godog
61+
env GOOS=$1 GOARCH=$2 go build -ldflags "-X github.com/cucumber/godog.Version=$(VERS)" -o $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/godog ./cmd/godog
6262
cp README.md $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/README.md
6363
cp LICENSE $(ARTIFACT_DIR)/godog-$(VERS)-$1-$2/LICENSE
6464
cd $(ARTIFACT_DIR) && tar -c --use-compress-program="pigz --fast" -f godog-$(VERS)-$1-$2.tar.gz godog-$(VERS)-$1-$2 && cd ..

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ godogs
244244
- godogs_test.go
245245
```
246246

247-
#### Step 6 - Add some logic to the step defintions
247+
#### Step 6 - Add some logic to the step definitions
248248

249249
Now lets implement our step definitions to test our feature requirements:
250250

_examples/api/features/version.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ Feature: get version
2020
And the response should match json:
2121
"""
2222
{
23-
"version": "v0.11.0"
23+
"version": "v0.0.0-dev"
2424
}
2525
"""

_examples/api/go.mod

Lines changed: 0 additions & 5 deletions
This file was deleted.

_examples/api/go.sum

Lines changed: 0 additions & 329 deletions
This file was deleted.

_examples/assert-godogs/go.mod

Lines changed: 0 additions & 9 deletions
This file was deleted.

_examples/assert-godogs/go.sum

Lines changed: 0 additions & 329 deletions
This file was deleted.

_examples/custom-formatter/go.mod

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)