-
Notifications
You must be signed in to change notification settings - Fork 120
189 lines (172 loc) · 6.33 KB
/
release-image.yml
File metadata and controls
189 lines (172 loc) · 6.33 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Release Image
on:
workflow_dispatch:
inputs:
image_tag:
description: 'The tag of image'
required: true
default: ''
image_name:
description: 'Only release select image'
required: false
default: ''
type: choice
options:
- ""
- aperag
- aperag-frontend
release:
types:
- published
env:
RELEASE_VERSION: ${{ github.ref_name }}
run-name: Release Image:${{ inputs.image_name }}:${{ inputs.image_tag }} ${{ github.ref_name }}
jobs:
image-tag:
runs-on: ubuntu-latest
outputs:
tag-name: ${{ steps.get_tag_name.outputs.tag_name }}
artifact-key: ${{ steps.get_tag_name.outputs.artifact_key }}
steps:
- name: Get Tag Name
id: get_tag_name
run: |
TAG_NAME=${{ inputs.image_tag }}
if [[ -z "$TAG_NAME" ]]; then
TAG_NAME="${{ env.RELEASE_VERSION }}"
fi
echo tag_name=$TAG_NAME >> $GITHUB_OUTPUT
ARTIFACT_KEY="${{ env.RELEASE_VERSION }}-image"
echo 'artifact_key='${ARTIFACT_KEY} >> $GITHUB_OUTPUT
release-aperag-image:
if: ${{ github.event.action == 'published' || inputs.image_name == '' || inputs.image_name == 'aperag' }}
name: release-aperag
needs: [ image-tag ]
uses: apecloud/apecloud-cd/.github/workflows/release-image-cache-sync.yml@v0.1.93
with:
IMG: "apecloud/aperag"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
DOCKERFILE_PATH: "./Dockerfile"
REMOVE_PREFIX: false
APECD_REF: "v0.1.93"
ENABLE_SUBMODULE: true
secrets: inherit
release-result:
runs-on: ubuntu-latest
needs: [ release-aperag-image ]
if: ${{ always() && (github.event.action == 'published' || contains(inputs.image_tag, 'nightly')) }}
outputs:
release-result: ${{ steps.get_release_result.outputs.release_result }}
steps:
- name: get release result
id: get_release_result
run: |
ARTIFACT_KEY="${{ env.RELEASE_VERSION }}-image"
touch ${ARTIFACT_KEY}
echo 'artifact_key='${ARTIFACT_KEY} >> $GITHUB_OUTPUT
RELEASE_RESULT="error"
if [[ "${{ needs.release-aperag-image.result }}" == "success" ]]; then
RELEASE_RESULT="success"
echo "success" > ${ARTIFACT_KEY}
else
echo "error" > ${ARTIFACT_KEY}
fi
echo 'release_result='$RELEASE_RESULT >> $GITHUB_OUTPUT
- name: Checkout apecloud-cd Code
uses: actions/checkout@v4
with:
repository: apecloud/apecloud-cd
path: apecloud-cd
ref: "v0.1.42"
- name: delete actions cache
continue-on-error: true
run: |
bash apecloud-cd/.github/utils/utils.sh --type 30 \
--github-repo "${{ github.repository }}" \
--tag-name "${{ steps.get_release_result.outputs.artifact_key }}"
- name: Save Artifact
id: cache-artifact-save
uses: actions/cache/save@v3
with:
path: |
${{ steps.get_release_result.outputs.artifact_key }}
key: ${{ steps.get_release_result.outputs.artifact_key }}
send-message:
needs: [ image-tag, release-result ]
if: ${{ always() && (github.event.action == 'published' || contains(inputs.image_tag, 'nightly')) }}
uses: apecloud/apecloud-cd/.github/workflows/feishui-message.yml@v0.1.36
with:
TYPE: "2"
CONTENT: "release image ${{ needs.image-tag.outputs.tag-name }} ${{ needs.release-result.outputs.release-result }}"
APECD_REF: "v0.1.36"
secrets: inherit
check-result:
if: github.event.action == 'published'
needs: [ release-result ]
runs-on: ubuntu-latest
strategy:
matrix:
type: [image, chart]
steps:
- name: Restore ${{ matrix.type }} Artifact
id: cache-artifact-restore
uses: actions/cache/restore@v3
with:
path: |
${{ env.RELEASE_VERSION }}-${{ matrix.type }}
key: ${{ env.RELEASE_VERSION }}-${{ matrix.type }}
- name: check release result
run: |
release_result=$( cat ${{ env.RELEASE_VERSION }}-${{ matrix.type }} )
if [[ "$release_result" != "success" ]]; then
exit 1
fi
e2e-aperag:
needs: [ image-tag, release-result, check-result ]
uses: apecloud/apecloud-cd/.github/workflows/trigger-workflow.yml@v0.1.41
with:
GITHUB_REPO: "apecloud/ApeRAG"
BRANCH_NAME: "main"
WORKFLOW_ID: "e2e-aperag.yml"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
APECD_REF: "v0.1.41"
secrets: inherit
release-aperag-frontend-image:
if: ${{ github.event.action == 'published' || inputs.image_name == '' || inputs.image_name == 'aperag-frontend' }}
name: release-aperag-frontend
needs: [ image-tag ]
uses: apecloud/apecloud-cd/.github/workflows/release-image-cache-sync.yml@v0.1.93
with:
IMG: "apecloud/aperag-frontend"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
DOCKERFILE_PATH: "./web/Dockerfile"
CONTEXT: "./web"
REMOVE_PREFIX: false
APECD_REF: "v0.1.93"
ENABLE_SUBMODULE: true
MAKE_OPS_PRE: "build-aperag-frontend-assets"
secrets: inherit
release-aperag-frontend-result:
runs-on: ubuntu-latest
needs: [ release-aperag-frontend-image ]
if: ${{ always() && (github.event.action == 'published' || contains(inputs.image_tag, 'nightly')) }}
outputs:
release-result: ${{ steps.get_release_result.outputs.release_result }}
steps:
- name: get release result
id: get_release_result
run: |
RELEASE_RESULT="error"
if [[ "${{ needs.release-aperag-frontend-image.result }}" == "success" ]]; then
RELEASE_RESULT="success"
fi
echo 'release_result='$RELEASE_RESULT >> $GITHUB_OUTPUT
send-aperag-frontend-message:
needs: [ image-tag, release-aperag-frontend-result ]
if: ${{ always() && (github.event.action == 'published' || contains(inputs.image_tag, 'nightly')) }}
uses: apecloud/apecloud-cd/.github/workflows/feishui-message.yml@v0.1.36
with:
TYPE: "2"
CONTENT: "release aperag-frontend image ${{ needs.image-tag.outputs.tag-name }} ${{ needs.release-aperag-frontend-result.outputs.release-result }}"
APECD_REF: "v0.1.36"
secrets: inherit