Skip to content

Commit

Permalink
add gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
magodo committed Aug 28, 2021
1 parent 07e1988 commit 2442600
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PR Check
on: [pull_request]
jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- name: Setup env
run: |
echo "::set-env name=GOPATH::$HOME/go"
echo "::set-env name=PATH::$PATH:$HOME/go/bin"
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.17
id: go

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

- name: make test
run: |
make test
depscheck:
name: depscheck
runs-on: ubuntu-latest
steps:
- name: Setup env
run: |
echo "::set-env name=GOPATH::$HOME/go"
echo "::set-env name=PATH::$PATH:$HOME/go/bin"
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.17
id: go

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

- name: make depscheck
run: |
make depscheck
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: goreleaser

on:
push:
tags:
- '*'

jobs:
goreleaser:
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.17
-
name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v2
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ install:

gen:
@./.tools/generate-provider-schema/run.sh $(PROVIDER_DIR) $(PROVIDER_VERSION)

depscheck:
@echo "==> Checking source code with go mod tidy..."
@go mod tidy
@git diff --exit-code -- go.mod go.sum || \
(echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; exit 1)

0 comments on commit 2442600

Please sign in to comment.