-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (39 loc) · 1.19 KB
/
build.yml
File metadata and controls
39 lines (39 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: default-pipeline
on:
push:
tags:
- v*
jobs:
pre-build-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.24.2"
- name: Install gofumpt
run: go install mvdan.cc/gofumpt@latest
- name: Check for compilation errors
run: go build ./cmd/dhee
- name: Check formatting
run: gofumpt -w -l . && git diff --exit-code
- name: Run tests
run: go test ./...
build-docker-image:
runs-on: ubuntu-latest
needs: [pre-build-checks]
env:
TAG_NAME: ${{ github.ref_name }}
IMAGE_NAME: ghcr.io/mahesh-hegde/dhee
steps:
- uses: actions/checkout@v4
- name: Docker login
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Docker build
run: docker build -t "${IMAGE_NAME}:latest" --platform linux/amd64 .
- name: Push latest image
run: docker push $IMAGE_NAME:latest
- name: Tag image
run: docker tag $IMAGE_NAME:latest $IMAGE_NAME:${TAG_NAME#v}
- name: Push tagged image
run: docker push $IMAGE_NAME:${TAG_NAME#v}