-
Notifications
You must be signed in to change notification settings - Fork 24
154 lines (150 loc) · 5.1 KB
/
publish.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name : Publish images, charts and binaries
on:
push:
tags:
- "v*"
env:
GHCR_REGISTRY: ghcr.io
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
YQ_VERSION: v4.44.3
jobs:
helm-locker-ci:
uses: ./.github/workflows/hl-ci.yaml
helm-project-operator-ci:
uses: ./.github/workflows/hpo-ci.yaml
with:
skip_build: 'true'
goreleaser:
name: Build go binaries and helm chart
runs-on : runs-on,image=ubuntu22-full-x64,runner=4cpu-linux-x64,run-id=${{ github.run_id }}
needs: [
helm-locker-ci,
helm-project-operator-ci,
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- name : setup Go
uses : actions/setup-go@v5
with:
go-version: 1.22
- name: Install mikefarah/yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq;
- uses: azure/setup-kubectl@v3
- name : Install helm
uses: azure/setup-helm@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare helm charts (needed for build)
run: |
BUILD_TARGET=prometheus-federator make package-helm && echo "pf: release chart prepared"
BUILD_TARGET=prometheus-federator make build-chart && echo "pf: embedded project-monitoring chart prepared"
- uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
push-dev-images:
name : Build and push helm-locker & Helm-Project-Operator images
runs-on : runs-on,image=ubuntu22-full-x64,runner=4cpu-linux-x64,run-id=${{ github.run_id }}
needs: [
helm-locker-ci,
helm-project-operator-ci,
]
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name : Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for helm-locker image
id: meta-locker
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}/helm-locker
- name: Build and push helm-locker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./package/Dockerfile-helm-locker
push: true
tags: ${{ steps.meta-locker.outputs.tags }}
labels: ${{ steps.meta-locker.outputs.labels }}
platforms : linux/amd64,linux/arm64
- name: Extract metadata (tags, labels) for Helm-Project-Operator image
id: meta-hpo
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REGISTRY }}/${{ env.IMAGE_NAME }}/helm-project-operator
- name: Build Helm-Project-Operator image
uses: docker/build-push-action@v5
with:
context: .
file: ./package/Dockerfile-helm-project-operator
push: true
tags: ${{ steps.meta-hpo.outputs.tags }}
labels: ${{ steps.meta-hpo.outputs.labels }}
platforms: linux/amd64,linux/arm64
publish-images:
name: Publish prometheus-federator image
runs-on: ubuntu-latest
needs: [
helm-locker-ci,
helm-project-operator-ci,
]
permissions:
contents : read
id-token: write
steps:
- name : "Read Secrets"
uses : rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name : Export image version
env:
GIT_TAG: ${{ github.ref_name }}
run : |
source ./scripts/version
echo IMAGE=$IMAGE >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Prometheus Federator image
uses: docker/build-push-action@v5
with:
context: .
file: ./package/Dockerfile-prometheus-federator
push: true
tags: ${{ env.IMAGE }}
platforms: linux/amd64,linux/arm64