Skip to content

Commit

Permalink
refactor ci, add release
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya committed Oct 26, 2020
1 parent 9b5c2bc commit 732247f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/go.yml → .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
Expand All @@ -20,7 +18,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
go-version: ^1.15
id: go

- name: Check out code into the Go module directory
Expand All @@ -44,8 +42,8 @@ jobs:
- name: Build and push Docker images
uses: docker/[email protected]
with:
username: imcitius
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}
repository: imcitius/checker
repository: ${{ secrets.REGISTRY_LOGIN }} /checker
tag_with_ref: true
tag_with_sha: true
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Go

on:
push:
tags:
- v*

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Build
run: go build -v -i -ldflags "-X my/checker/config.Version=${GITHUB_REF} -X my/checker/config.VersionSHA=${GITHUB_SHA} -X my/checker/config.VersionBuild=${GITHUB_RUN_ID}" -o build/${BINARY_NAME}
env:
BINARY_NAME: "checker"

- name: Upload a Build Artifact
uses: actions/upload-artifact@v2
with:
name: checker
path: build/checker

- name: Build and push Docker images
uses: docker/[email protected]
with:
username: ${{ secrets.REGISTRY_LOGIN }}
password: ${{ secrets.REGISTRY_PASSWORD }}
repository: ${{ secrets.REGISTRY_LOGIN }} /checker
tag_with_ref: true
tag_with_sha: true

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/checker
asset_name: checker
tag: ${{ github.ref }}
overwrite: true
body: "Checker release ${GITHUB_REF}"

0 comments on commit 732247f

Please sign in to comment.