Add github workflow (#1)

* Add github workflow
This commit is contained in:
2021-11-11 17:09:05 +01:00
committed by GitHub
parent c0d1143de6
commit 36f82eb6a7
3 changed files with 60 additions and 4 deletions

42
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: CI
on:
push:
branches:
- main
tags:
- '*'
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Lint
run: make lint
- name: Tests
run: make test
deploy:
runs-on: ubuntu-latest
needs: tests
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Sign in to dockerhub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Deploy image
run: make docker-build VERSION=$RELEASE_VERSION