Skip to content

chore(deps): update actions/setup-go action to v5 #80

chore(deps): update actions/setup-go action to v5

chore(deps): update actions/setup-go action to v5 #80

Workflow file for this run

name: commentapi-ci
# work on path /cmd/commentapi
on:
push:
paths:
- 'cmd/commentapi/**'
- '.github/workflows/commentapi-ci.yaml'
branches:
- main
pull_request:
paths:
- 'cmd/commentapi/**'
- '.github/workflows/commentapi-ci.yaml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.19
- name: Build commentapi Binary Executable
run: |
go mod tidy
cd cmd/commentapi
go mod tidy
go build -ldflags="-s -w" -o commentapi
- name: Login to DockerHub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./cmd/commentapi
file: ./cmd/commentapi/Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ secrets.DOCKERHUB_USERNAME || 'commentapi' }}/commentapi:latest