-
Notifications
You must be signed in to change notification settings - Fork 176
103 lines (92 loc) · 3.25 KB
/
release-image.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
name: RELEASE-IMAGE
on:
schedule:
- cron: '0 0 * * 1-5' # Runs at 00:00 UTC on Mon to Friday
workflow_dispatch:
inputs:
image_tag:
description: 'image tag'
required: false
default: 'latest'
release:
types:
- published
env:
GH_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ github.ref_name }}
RELEASE_BOT_WEBHOOK: ${{ secrets.RELEASE_BOT_WEBHOOK }}
jobs:
image-tag:
runs-on: ubuntu-latest
outputs:
tag-name: ${{ steps.get_tag_name.outputs.tag_name }}
steps:
- name: Get Tag Name
id: get_tag_name
run: |
TAG_NAME="latest"
if [[ ! -z "${{ inputs.image_tag }}" ]]; then
TAG_NAME="${{ inputs.image_tag }}"
elif [[ "${{ env.RELEASE_VERSION }}" == "main" ]]; then
TAG_NAME="latest"
elif [[ ! -z "${{ env.RELEASE_VERSION }}" ]]; then
TAG_NAME=${{ env.RELEASE_VERSION }}
fi
echo tag_name=$TAG_NAME >> $GITHUB_OUTPUT
release-image:
needs: image-tag
uses: apecloud/apecloud-cd/.github/workflows/release-image.yml@v0.1.0
with:
MAKE_OPS_PRE: "generate"
MAKE_OPS: "push-manager-image"
IMG: "apecloud/kubeblocks"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
GO_VERSION: "1.20"
APECD_REF: "v0.1.0"
secrets: inherit
release-tools-image:
needs: image-tag
uses: apecloud/apecloud-cd/.github/workflows/release-image.yml@v0.1.0
with:
MAKE_OPS_PRE: "generate"
MAKE_OPS: "push-tools-image"
IMG: "apecloud/kubeblocks-tools"
VERSION: "${{ needs.image-tag.outputs.tag-name }}"
GO_VERSION: "1.20"
APECD_REF: "v0.1.0"
secrets: inherit
send-message:
runs-on: ubuntu-latest
needs: [ release-image, release-tools-image ]
if: ${{ always() && github.event.action == 'published' }}
steps:
- uses: actions/checkout@v3
- name: send message
id: send_message
run: |
release_result="${{ env.RELEASE_VERSION }}-image"
touch ${release_result}
echo 'release-result='${release_result} >> $GITHUB_OUTPUT
CONTENT="release\u00a0${{ env.RELEASE_VERSION }}\u00a0image\u00a0error"
if [[ "${{ needs.release-image.result }}" == "success" && "${{ needs.release-tools-image.result }}" == "success" ]]; then
CONTENT="release\u00a0${{ env.RELEASE_VERSION }}\u00a0image\u00a0success"
echo "success" > ${release_result}
else
echo "error" > ${release_result}
fi
bash .github/utils/utils.sh --type 12 \
--tag-name ${{ env.RELEASE_VERSION }} \
--content "${CONTENT}"\
--bot-webhook ${{ env.RELEASE_BOT_WEBHOOK }} \
--run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
- name: delete cache
continue-on-error: true
run: |
bash .github/utils/utils.sh --type 17 --tag-name "${{ steps.send_message.outputs.release-result }}"
- name: Save Artifact
id: cache-artifact-save
uses: actions/cache/save@v3
with:
path: |
${{ steps.send_message.outputs.release-result }}
key: ${{ steps.send_message.outputs.release-result }}