Skip to content

Commit

Permalink
Add github action build and release workflows for synse modbus ip plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
erik-east committed Sep 11, 2023
1 parent 63712e9 commit a3f889a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: build
on:
push:
branches:
- '*'
pull_request: {}

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- run: "go vet ./..."
- name: Lint
uses: dominikh/staticcheck-action@v1.3.0
with:
version: "2022.1.3"
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- run: "make test"
snapshot-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Set GOLANG_VERSION
run: |
echo "GOLANG_VERSION=$(go version | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Snapshot Build
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --snapshot --skip-publish --clean
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: release
on:
push:
tags:
- 'v*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Set GOLANG_VERSION
run: |
echo "GOLANG_VERSION=$(go version | awk '{ print $3 }')" >> $GITHUB_ENV
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Tagged Release
uses: goreleaser/goreleaser-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
distribution: goreleaser
version: latest
args: release --clean
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ builds:
- -X github.com/vapor-ware/synse-sdk/sdk.BuildDate={{ .Date }}
- -X github.com/vapor-ware/synse-sdk/sdk.GitCommit={{ .ShortCommit }}
- -X github.com/vapor-ware/synse-sdk/sdk.GitTag={{ .Tag }}
- -X github.com/vapor-ware/synse-sdk/sdk.GoVersion={{ .Env.GOVERSION }}
- -X github.com/vapor-ware/synse-sdk/sdk.GoVersion={{ .Env.GOLANG_VERSION }}
- -X github.com/vapor-ware/synse-sdk/sdk.PluginVersion={{ .Version }}
goos:
- linux
Expand Down

0 comments on commit a3f889a

Please sign in to comment.