Skip to content

Merge pull request #62 from Euler-B/dependabot/go_modules/golang.org/… #84

Merge pull request #62 from Euler-B/dependabot/go_modules/golang.org/…

Merge pull request #62 from Euler-B/dependabot/go_modules/golang.org/… #84

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
build-image:
name: Build Image for Deployment
needs: build
runs-on: ubuntu-latest
env:
DOCKER_IMAGE_NAME: ghcr.io/euler-b/api-rest_go
steps:
- name: Get source code
uses: actions/checkout@v4
- name: "Login into Github Container Registry (a.k.a. ghcr.io)"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build and push Docker image to Github Container Registry ('latest')"
if: ${{ github.ref == 'refs/heads/master' }}
run: |
docker build . --tag $DOCKER_IMAGE_NAME:latest
docker push $DOCKER_IMAGE_NAME:latest