-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use gh actions for testing, releasing
- Loading branch information
Showing
6 changed files
with
136 additions
and
60 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
name: build | ||
on: [ | ||
push, | ||
pull_request | ||
] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: vars | ||
run: | | ||
echo ::set-output name=go_version::$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') | ||
echo "Using Go version ${{ steps.vars.outputs.go_version }}" | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ steps.vars.outputs.go_version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: build | ||
run: | | ||
make build | ||
make test | ||
make vet | ||
make lint |
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,30 @@ | ||
name: GoReleaser | ||
on: | ||
workflow_run: | ||
workflows: ["Bump Git/Docker Version"] | ||
branches: [master] | ||
types: | ||
- completed | ||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
- id: vars | ||
run: | | ||
echo ::set-output name=go_version::$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') | ||
echo "Using Go version ${{ steps.vars.outputs.go_version }}" | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ steps.vars.outputs.go_version }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,52 @@ | ||
name: Bump Git/Docker Version | ||
on: | ||
push: | ||
branches: | ||
- master | ||
env: | ||
PLATFORMS: linux/arm/v7,linux/amd64,linux/arm64, windows/amd64, darwin/amd64 | ||
|
||
jobs: | ||
semver: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag: ${{ steps.tagging.outputs.new_tag }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- name: Bump version and push tag | ||
uses: anothrNick/github-tag-action@1.39.0 | ||
id: tagging | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: true | ||
RELEASE_BRANCHES: master | ||
DEFAULT_BUMP: minor | ||
docker: | ||
runs-on: ubuntu-latest | ||
needs: semver | ||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.docker_username }} | ||
password: ${{ secrets.docker_password }} | ||
- name: Build and push latest | ||
id: docker_build_latest | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: ${{ github.repository }}:latest | ||
platforms: ${{ env.PLATFORMS }} | ||
- name: Build and push versioned | ||
id: docker_build_versioned | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
tags: ${{ github.repository }}:${{ needs.semver.outputs.tag }} | ||
platforms: ${{ env.PLATFORMS }} |
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,27 @@ | ||
# Visit https://goreleaser.com for documentation on how to customize this | ||
# behavior. | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- env: | ||
# goreleaser does not work with CGO, it could also complicate | ||
# usage by users in CI/CD systems like Terraform Cloud where | ||
# they are unable to install libraries. | ||
- CGO_ENABLED=0 | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- '-s -w -X main.Version={{.Version}} -X main.Commit={{.Commit}}' | ||
goos: | ||
- linux | ||
goarch: | ||
- amd64 | ||
binary: '{{ .ProjectName }}_v{{ .Version }}' | ||
archives: | ||
- format: binary | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' | ||
changelog: | ||
skip: false | ||
sort: asc |
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