-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upload artifacts after a release is created (#7)
use skx/github-action-publish-binaries allowing multiple files at once use go action v2 build darwin binary add license
- Loading branch information
1 parent
b0f2b6f
commit e74881e
Showing
4 changed files
with
95 additions
and
30 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 |
---|---|---|
|
@@ -6,13 +6,13 @@ on: | |
branches: | ||
- master | ||
|
||
name: test and build | ||
name: run tests | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2-beta | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15.x | ||
- name: Checkout code | ||
|
@@ -22,7 +22,7 @@ jobs: | |
go get github.com/golangci/golangci-lint/cmd/golangci-lint | ||
- name: Run linters | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | ||
./pre-commit | ||
test: | ||
|
@@ -34,7 +34,7 @@ jobs: | |
steps: | ||
- name: Install Go | ||
if: success() | ||
uses: actions/setup-go@v2-beta | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Checkout code | ||
|
@@ -47,14 +47,13 @@ jobs: | |
steps: | ||
- name: Install Go | ||
if: success() | ||
uses: actions/setup-go@v2-beta | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15.x | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Calc coverage | ||
run: | | ||
export PATH=$PATH:$(go env GOPATH)/bin | ||
go test -v -covermode=count -coverprofile=coverage.out | ||
- name: Convert coverage to lcov | ||
uses: jandelgado/[email protected] | ||
|
@@ -67,23 +66,3 @@ jobs: | |
github-token: ${{ secrets.github_token }} | ||
path-to-lcov: coverage.lcov | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: [lint, test] | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2-beta | ||
with: | ||
go-version: 1.15.x | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: build | ||
run: | | ||
export GO111MODULE=on | ||
GOOS=windows GOARCH=amd64 go build -o bin/ci-test-windows-amd64.exe | ||
GOOS=linux GOARCH=amd64 go build -o bin/ci-test-linux-amd64 | ||
- name: upload artifacts | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: binaries | ||
path: bin/ |
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,65 @@ | ||
on: | ||
release: | ||
types: [created] | ||
|
||
name: Upload release assets after release is created | ||
jobs: | ||
build: | ||
name: build binaries | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15.x | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: build | ||
run: | | ||
echo "GO111MODULE=on" >> $GITHUB_ENV | ||
GOOS=windows GOARCH=amd64 go build -o bin/ci-test-windows-amd64.exe | ||
GOOS=linux GOARCH=amd64 go build -o bin/ci-test-linux-amd64 | ||
GOOS=darwin GOARCH=amd64 go build -o bin/ci-test-macos-amd64 | ||
- name: upload artifacts | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: binaries | ||
path: bin/ | ||
|
||
upload: | ||
name: Upload release assets | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
|
||
- name: Branch name | ||
id: branch_name | ||
run: | | ||
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/} | ||
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/} | ||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/} | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Download build artefacts | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: binaries | ||
path: bin/ | ||
|
||
- name: Create asset zips | ||
env: | ||
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }} | ||
run: | | ||
mkdir assets | ||
zip assets/ci-test-${SOURCE_TAG}-windows-amd64.zip bin/ci-test-windows-amd64.exe README.md | ||
zip assets/ci-test-${SOURCE_TAG}-linux-amd64.zip bin/ci-test-linux-amd64 README.md | ||
zip assets/ci-test-${SOURCE_TAG}-darwin-amd64.zip bin/ci-test-darwin-amd64 README.md | ||
sha256sum assets/*zip > assets/SHASUMS256.txt | ||
- name: Upload release assets | ||
uses: skx/github-action-publish-binaries@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
args: './assets/*' |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019-2020 Jan Delgado, jdelgado[at]gmx.net | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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