This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
forked from xanzy/go-cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: build-and-release | ||
|
||
on: | ||
push: | ||
# not not consider simplec commit | ||
branches: | ||
- '!*' | ||
# consider only release and pre-release tags | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
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 | ||
|
||
- 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: tests modules | ||
run: | | ||
go mod vendor | ||
if [ ! -z "$(git status --porcelain)" ]; then | ||
echo "::error::vendor directory if not synched with go.mod, please run go mod vendor" | ||
exit 1 | ||
fi | ||
go mod tidy | ||
if [ ! -z "$(git status --porcelain)" ]; then | ||
echo "::error::modules are not tidy, please run go mod tidy" | ||
exit 1 | ||
fi | ||
- name: tests | ||
run: | | ||
go test -v ./... | ||
- name: run goreleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
if: success() && startsWith(github.ref, 'refs/tags/') | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
USER: github-actions |