forked from odigos-io/odigos
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (139 loc) · 5.62 KB
/
release.yml
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
155
156
157
158
159
160
161
162
163
name: Release Odigos
on:
workflow_dispatch:
inputs:
tag:
description: "Tag"
required: true
repository_dispatch:
types: [release_cli]
permissions:
contents: write
packages: write
env:
DOCKERHUB_ORG: "keyval"
jobs:
release-cli:
runs-on: ubuntu-latest
steps:
- name: Determine Tag Value
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" = "repository_dispatch" ]; then
echo "TAG=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV
else
echo "Unknown event type"
exit 1
fi
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ env.TAG }}
- name: Set env
id: vars
run: |
SHORT_COMMIT=$(git rev-parse --short HEAD)
echo "short_commit=${SHORT_COMMIT}" >> $GITHUB_ENV
echo "date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
- name: Notify Slack Start
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"description":"Starting Odigos CLI release", "tag":"${{ env.TAG }}"}' ${{ env.SLACK_WEBHOOK_URL }}
- name: Verify Components Image Ready
run: |
declare -a REPOS=("odigos-autoscaler" "odigos-scheduler" "odigos-instrumentor" "odigos-odiglet" "odigos-collector" "odigos-enterprise-odiglet" "odigos-ui")
TAG_TO_CHECK=${{ env.TAG }}
for REPO in "${REPOS[@]}"; do
echo "Checking tag $TAG_TO_CHECK in $REPO..."
TAGS_JSON=$(curl -s "https://hub.docker.com/v2/repositories/${{ env.DOCKERHUB_ORG }}/$REPO/tags/")
if echo "$TAGS_JSON" | grep -q "\"name\":\"$TAG_TO_CHECK\""; then
echo "Tag $TAG_TO_CHECK exists in Docker Hub repository $REPO."
else
echo "Tag $TAG_TO_CHECK does not exist in Docker Hub repository $REPO."
exit 1
fi
done
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
# TODO: Remove once we are ready to fully sunset managing charts in a separate repo
- name: Trigger Release PR in Odigos Charts
run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.RELEASE_BOT_TOKEN }}" \
https://api.github.com/repos/odigos-io/odigos-charts/dispatches \
-d '{"event_type": "create_release_pr", "client_payload": {"tag": "${{ env.TAG }}"}}'
- uses: ko-build/setup-ko@v0.7
- name: publish cli image to docker registries
working-directory: ./cli
env:
KO_DOCKER_REPO: ${{ env.DOCKERHUB_ORG }}/odigos-cli
KO_CONFIG_PATH: ./.ko.yaml
VERSION: ${{ env.TAG }}
SHORT_COMMIT: ${{ steps.vars.outputs.short_commit }}
DATE: ${{ steps.vars.outputs.date }}
run: |
ko build --bare --tags latest --tags ${{ env.TAG }} --platform=all .
- name: Notify Slack End
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"description":"Odigos CLI released successfully. new version is ready", "tag":"${{ env.TAG }}"}' ${{ env.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Failure
if: ${{ failure() || cancelled() }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"link":"https://github.com/${{ env.GITHUB_REPOSITORY }}/actions/runs/${{ env.GITHUB_RUN_ID }}", "description":"ERROR: failed to publish odigos CLI", "tag":"${{ env.TAG }}"}' ${{ env.SLACK_WEBHOOK_URL }}
release-helm:
needs: [release-cli]
runs-on: ubuntu-latest
steps:
- name: Determine Tag Value
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" = "repository_dispatch" ]; then
echo "TAG=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV
else
echo "Unknown event type"
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.email "bot@odigos.io"
git config --global user.name "Odigos Release Bot"
- name: Install Helm
uses: azure/setup-helm@v4.2.0
with:
version: v3.15.2
- name: Release Helm charts
env:
GH_TOKEN: ${{ github.token }}
run: bash ./scripts/release-charts.sh