Skip to content

Merge pull request #29 from brucetieu/dependabot/go_modules/github.co… #69

Merge pull request #29 from brucetieu/dependabot/go_modules/github.co…

Merge pull request #29 from brucetieu/dependabot/go_modules/github.co… #69

Workflow file for this run

name: Blockchain
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- master
pull_request:
branches:
- master
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# The "build" workflow
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Setup Go
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '>=1.17.0'
# Run build of the application
- name: Run build
run: go build .
# Linting
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
fail_on_error: true
# Run testing on the code
- name: Run testing
run: go test -v
# The "deploy" workflow
deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: [build] # Only run this workflow when "build" workflow succeeds
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }} # Only run this workflow if it is master branch on push event
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: brucetieu/blockchain:latest