chore: Configure Renovate #20
This file contains hidden or 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
name: CI | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
jobs: | |
lint-go: | |
name: Lint Go | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.14.x | |
- name: Check out code | |
uses: actions/checkout@v1 | |
- name: Lint Go Code | |
run: | | |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh |sudo sh -s -- -b /usr/local/bin v1.25.0 | |
golangci-lint run . -v | |
test-unit: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.14.x | |
- name: Check out code | |
uses: actions/checkout@v1 | |
- name: Run Tests | |
run: make test-cover | |
- name: Upload Coverage report to Codacy | |
uses: brpaz/[email protected] | |
with: | |
reportPath: "coverage/cover.out" | |
codacyToken: ${{ secrets.CODACY_TOKEN }} | |
commitId: ${{ github.sha }} | |
tag: | |
name: Tag Release | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
needs: [lint-go, test-unit] | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: "12.x" | |
- name: Bump version and Generate Changelog | |
run: | | |
git config user.name "$(git --no-pager log --format=format:'%an' -n 1)" | |
git config user.email "$(git --no-pager log --format=format:'%ae' -n 1)" | |
npx standard-version -no-verify | |
git remote rm origin | |
git remote add origin https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git | |
git push --follow-tags origin HEAD:master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
goreleaser: | |
runs-on: ubuntu-latest | |
needs: [tag] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Unshallow | |
run: git fetch --prune --unshallow | |
- name: Get Latest Tag | |
run: | | |
git fetch --tags | |
TAG=$(git tag | tail -1) | |
git checkout $TAG | |
echo ::set-env name=GORELEASER_CURRENT_TAG::$(git tag | tail -1) | |
- name: Set up Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.14.x | |
- name: Login in Docker registry | |
uses: azure/docker-login@v1 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v1 | |
with: | |
version: latest | |
args: release --rm-dist --release-notes CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |