-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (59 loc) · 1.65 KB
/
Copy pathrelease.yml
File metadata and controls
67 lines (59 loc) · 1.65 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: release
on:
push:
branches:
- master
workflow_dispatch:
jobs:
vet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
cache: false
# Scoped to src: node_modules ships a stray Go package that ./... would
# otherwise build.
- run: go vet ./src/...
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
cache: false
- run: CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /tmp/httphq ./src
publish:
needs: [vet, build]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- id: meta
run: |
OWNER="$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')"
TAG="$(date -u +'%Y.%m.%d-%H%M%S')-${GITHUB_SHA::7}"
IMAGE="ghcr.io/${OWNER}/httphq"
{
echo "tag=${TAG}"
echo "image=${IMAGE}:${TAG}"
echo "image_latest=${IMAGE}:latest"
} >> "$GITHUB_OUTPUT"
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v4
- uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
push: true
tags: |
${{ steps.meta.outputs.image }}
${{ steps.meta.outputs.image_latest }}