generated from ViBiOh/goweb
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (104 loc) · 3.34 KB
/
build.yaml
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
---
name: Build
permissions:
actions: none
checks: none
contents: read
deployments: none
issues: none
packages: none
pages: none
pull-requests: none
repository-projects: none
security-events: none
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
SCRIPTS_NO_INTERACTIVE: "true"
defaults:
run:
shell: bash
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: "^1.23"
cache: true
- name: Build
run: |
make
git --no-pager diff -- ':(exclude)go.sum' && git diff --quiet -- ':(exclude)go.sum'
package:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: "^1.23"
cache: true
- name: Build
env:
GO_ARCHS: linux/amd64 linux/arm linux/arm64 darwin/amd64 darwin/arm64
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY }}
DD_ENV: production
DD_SERVICE: ketchup
DD_SITE: datadoghq.eu
PGO_NAME: ketchup
run: |
curl --disable --silent --show-error --location --max-time 30 "https://raw.githubusercontent.com/ViBiOh/scripts/main/bootstrap.sh" | bash -s -- "-c" "release.sh"
./scripts/release.sh build
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Setup DockerHub
if: env.DOCKER_USER && env.DOCKER_PASS
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Docker
if: env.DOCKER_USER && env.DOCKER_PASS
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
run: |
DOCKER_IMAGE="${{ secrets.DOCKER_USER }}/$(make name)" IMAGE_VERSION="$(make version)" GIT_SHA="$(make version-full)" ./scripts/release.sh docker
publish:
name: Publish
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: package
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish
if: env.DOCKER_USER && env.DOCKER_PASS
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
run: |
curl --disable --silent --show-error --location --max-time 30 "https://raw.githubusercontent.com/ViBiOh/scripts/main/bootstrap.sh" | bash -s -- "-c" "docker_promote.sh"
scripts/docker_promote.sh -d "$(make version-date)" "${{ secrets.DOCKER_USER }}/$(make name)" "$(make version)"
- name: Flux
env:
FLUX_TOKEN: ${{ secrets.FLUX_TOKEN }}
FLUX_WEBHOOK_URL: ${{ secrets.FLUX_WEBHOOK_URL }}
run: |
curl --disable --silent --show-error --location --max-time 30 --header "X-Signature: sha256=$(printf "{}" | openssl dgst -sha256 -r -hmac "${FLUX_TOKEN}"| awk '{print $1}')" --data "{}" "${FLUX_WEBHOOK_URL}"