Skip to content

Commit

Permalink
Add release step to goigc workflow
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
rochaporto committed Dec 1, 2019
1 parent 331ad12 commit f065ed3
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 9 deletions.
26 changes: 19 additions & 7 deletions .github/workflows/goigc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ on:
push:
branches:
- '*'
tags:
- 'v*'
paths-ignore:
- 'README.md'
- 'docs/**'
Expand All @@ -40,16 +42,26 @@ jobs:
if: matrix.target_arch != 'arm'
run: |
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${{ env.GOROOT }}/bin" v1.21.0
- name: Check out code into the Go module directory
- name: Check out code
uses: actions/checkout@v1
- name: Run make test
- name: Make test
run: |
make test
- name: Run make release to build and archive binaries
- name: Make build for cross platform binaries
run: |
make build-cross
- name: upload artifacts
uses: actions/upload-artifact@master
- name: Make changelog
if: startsWith(github.ref, 'refs/tags/v')
run: |
sudo apt-get update
sudo apt-get install ruby
make changelog
- name: Release cross platform binaries
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
name: goigc_dist
path: _dist
files: |
_dist/**
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.coverage/
_dist/
bin/
CHANGELOG.md
go.sum
profile.cov
vendor/
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ $(GOIMPORTS):
.PHONY: build-cross
build-cross: LDFLAGS += -extldflags "-static"
build-cross: $(GOX)
GO111MODULE=on CGO_ENABLED=0 $(GOX) -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/$(BINNAME)" -osarch='$(TARGETS)' $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' ./cmd/goigc
GO111MODULE=on CGO_ENABLED=0 $(GOX) -parallel=3 -output="_dist/{{.OS}}-{{.Arch}}/$(BINNAME)_{{.OS}}_{{.Arch}}" -osarch='$(TARGETS)' $(GOFLAGS) -tags '$(TAGS)' -ldflags '$(LDFLAGS)' ./cmd/goigc

.PHONY: dist
dist:
Expand All @@ -128,8 +128,11 @@ checksum:
shasum -a 256 "$${f}" | awk '{print $$1}' > "$${f}.sha256" ; \
done

# ------------------------------------------------------------------------------
.PHONY: changelog
changelog:
@./scripts/changelog.sh

# ------------------------------------------------------------------------------
.PHONY: clean
clean:
@rm -rf $(BINDIR) ./_dist
Expand Down
28 changes: 28 additions & 0 deletions scripts/changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# Copyright The ezgliding Authors.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Based on the Helm script file:
# github.com/helm/helm/scripts/coverage.sh

set -euo pipefail

if ! [ -x "$(command -v github_changelog_generator)" ]; then
gem install --user-install github_changelog_generator
export PATH=$PATH:$(find ~/.gem -name bin | tail -1)
fi

github_changelog_generator -u ezgliding -p goigc --since-tag $(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)

0 comments on commit f065ed3

Please sign in to comment.