php-fpm-exporter/.github/workflows/go.yml

90 lines
2 KiB
YAML

name: Go
on: [push]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Checkout
uses: actions/checkout@v2
- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.7
- name: Lint
run: $(go env GOPATH)/bin/golangci-lint run
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Checkout
uses: actions/checkout@v2
- name: Test
run: go test ./...
tag:
name: Tag
runs-on: ubuntu-latest
needs: [lint, test]
if: github.ref == 'refs/heads/master'
steps:
- name: Setup Node.js for use with actions
uses: actions/setup-node@v1.1.0
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Install semantic-release
run: yarn global add --no-progress --non-interactive "semantic-release" "@semantic-release/exec"
- name: Run semantic-release
run: $(yarn global bin)/semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
needs: [lint, test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
key: ${{ secrets.YOUR_PRIVATE_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}