From 1cbc5cebb8ebabc3fc2d9e40b6f61bac2d490ad3 Mon Sep 17 00:00:00 2001 From: Glenn Vriesman Date: Fri, 5 Jun 2020 17:18:59 +0200 Subject: [PATCH] ci/cd: setup actions Signed-off-by: Glenn Vriesman --- .github/workflows/main.yml | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e1386f5 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,57 @@ +name: Release + +on: + push: + branches: + - master + tags: + - '*' # Push events to v1.0, v1.1, and v1.9 tags + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.14 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Set env + run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} + + - name: Get dependencies + run: | + go get -v -t -d ./... + if [ -f Gopkg.toml ]; then + curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh + dep ensure + fi + + - name: golangci-lint + uses: golangci/golangci-lint-action@v1 + with: + version: v1.27 + + - name: Test + run: go test -v . + + - name: Build + run: go build -v . + + - name: Build + run: docker build -t ${GITHUB_REPOSITORY}:latest -t ${GITHUB_REPOSITORY}:${{ env.RELEASE_VERSION }} . + + - name: Push latest to docker hub + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: glvr182/f2b-exporter + tag_with_ref: true + add_git_labels: true \ No newline at end of file