-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (39 loc) · 1.14 KB
/
package.yaml
File metadata and controls
50 lines (39 loc) · 1.14 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
40
41
42
43
44
45
46
47
48
49
50
name: Sample API
on:
push:
tags:
- 'v*'
jobs:
release_package:
if: ${{ startsWith(github.ref, 'refs/tags/v')}}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Get dependencies
run: |
go mod download
- name: Build
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -o main
- name: Extract Release Tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: "v4vikash"
password: ${{ secrets.DOCKER_HUB_PAT }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
push: true
context: .
file: Dockerfile
tags: zopdev/sample-go-api:${{ env.RELEASE_VERSION }}, zopdev/sample-go-api:latest