-
Notifications
You must be signed in to change notification settings - Fork 95
194 lines (168 loc) · 7.08 KB
/
publish.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
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
190
191
192
193
194
name: Build and Publish RPM Package
on:
push:
branches: [ master ]
tags:
- "v*"
paths-ignore:
- '*.md'
pull_request:
branches: [ master ]
paths-ignore:
- '*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }}
cancel-in-progress: true
jobs:
publish_apisix:
name: Build and Publish RPM Package
strategy:
fail-fast: false
matrix:
platform:
- runner: ubuntu-22.04
arch: x86_64
- runner: buildjet-2vcpu-ubuntu-2204-arm
arch: aarch64
runs-on: ${{ matrix.platform.runner }}
timeout-minutes: 180
env:
VAR_COS_BUCKET_CI: ${{ secrets.VAR_COS_BUCKET_CI }}
VAR_COS_BUCKET_REPO: ${{ secrets.VAR_COS_BUCKET_REPO }}
VAR_COS_ENDPOINT: ${{ secrets.VAR_COS_ENDPOINT }}
VAR_RPM_WORKBENCH_DIR: /tmp/output
ARCH: ${{ matrix.platform.arch }}
steps:
- name: Check out code
uses: actions/checkout@v2.3.5
with:
submodules: recursive
- name: Init basic publish env
run: |
# install publish env deps
sudo apt-get update
sudo apt install -y createrepo-c
mkdir -p "${VAR_RPM_WORKBENCH_DIR}"
# init env var
TAG_DATE=$(date +%Y%m%d)
echo "TAG_DATE=${TAG_DATE}" >> "$GITHUB_ENV"
- name: Extract Tags version
if: ${{ startsWith(github.ref, 'refs/tags/') }}
shell: bash
run: |
echo "TAG_VERSION=3.10.0" >> "$GITHUB_ENV"
- name: Extract Tags Type
shell: bash
run: |
type=$(echo ${GITHUB_REF} | awk -F '/' '{print $3}')
echo "TAG_TYPE=apisix" >> "$GITHUB_ENV"
- name: Check Tags Type
if: ${{ env.TAG_TYPE != 'apisix' && env.TAG_TYPE != 'apisix-base' && env.TAG_TYPE != 'dashboard' }}
run: |
echo "##[error]Tag type is not correct, or not support, please check it."
exit 1
- name: Build apisix RPM Package
if: ${{ env.TAG_TYPE == 'apisix' }}
env:
APISIX_TAG_VERSION: ${{ env.TAG_VERSION }}
run: |
wget https://raw.githubusercontent.com/apache/apisix/3.10.0/.requirements
source .requirements
# build apisix
make package type=rpm app=apisix openresty=apisix-runtime runtime_version=${APISIX_RUNTIME} checkout=3.10.0 version=3.10.0 image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6
mv ./output/apisix-3.10.0-0.ubi8.6.${ARCH}.rpm ${VAR_RPM_WORKBENCH_DIR}
echo "TARGET_APP=apisix" >> "$GITHUB_ENV"
- name: Build apisix-base RPM Package
if: ${{ env.TAG_TYPE == 'apisix-base' }}
env:
APISIX_BASE_TAG_VERSION: ${{ env.TAG_VERSION }}
run: |
# build apisix-base
echo ${{ env.TAG_TYPE }} ${{ env.TAG_VERSION }}
make package type=rpm app=apisix-base checkout=${APISIX_BASE_TAG_VERSION} version=${APISIX_BASE_TAG_VERSION} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6
mv ./output/apisix-base-${APISIX_BASE_TAG_VERSION}-0.ubi8.6.${ARCH}.rpm ${VAR_RPM_WORKBENCH_DIR}
echo "TARGET_APP=apisix-base" >> "$GITHUB_ENV"
- name: Build apisix-runtime RPM Package
if: ${{ env.TAG_TYPE == 'apisix-runtime' }}
env:
APISIX_RUNTIME_TAG_VERSION: ${{ env.TAG_VERSION }}
run: |
# build apisix-runtime
echo ${{ env.TAG_TYPE }} ${{ env.TAG_VERSION }}
make package type=rpm app=apisix-runtime checkout=${APISIX_RUNTIME_TAG_VERSION} version=${APISIX_RUNTIME_TAG_VERSION} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6
mv ./output/apisix-runtime-${APISIX_RUNTIME_TAG_VERSION}-0.ubi8.6.${ARCH}.rpm ${VAR_RPM_WORKBENCH_DIR}
echo "TARGET_APP=apisix-runtime" >> "$GITHUB_ENV"
- name: Build apisix-dashboard RPM Package
if: ${{ env.TAG_TYPE == 'dashboard' }}
env:
APISIX_DASHBOARD_TAG_VERSION: ${{ env.TAG_VERSION }}
run: |
# build apisix dashboard
mv ./output/apisix-dashboard-${APISIX_DASHBOARD_TAG_VERSION}-0.el{7,8}.${ARCH}.rpm ${VAR_RPM_WORKBENCH_DIR}
echo "TARGET_APP=apisix-dashboard" >> "$GITHUB_ENV"
- name: Ensure the upload dir
run: |
ls -al "${VAR_RPM_WORKBENCH_DIR}"
- name: Upload apisix Artifact for Redhat
if: ${{ env.TAG_TYPE == 'apisix' }}
uses: actions/upload-artifact@v4.0.0
env:
PACKAGE_NAME: apisix-3.10.0-0.ubi8.6.${{ env.ARCH }}.rpm
with:
name: "${{ env.PACKAGE_NAME }}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}"
- name: Upload apisix-base Artifact for Redhat
if: ${{ env.TAG_TYPE == 'apisix-base' }}
uses: actions/upload-artifact@v4.0.0
env:
PACKAGE_NAME: apisix-base-${{ env.TAG_VERSION }}-0.ubi8.6.${{ env.ARCH }}.rpm
with:
name: "${{ env.PACKAGE_NAME }}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}"
- name: Upload apisix-runtime Artifact for Redhat
if: ${{ env.TAG_TYPE == 'apisix-runtime' }}
uses: actions/upload-artifact@v4.0.0
env:
PACKAGE_NAME: apisix-runtime-${{ env.TAG_VERSION }}-0.ubi8.6.${{ env.ARCH }}.rpm
with:
name: "${{ env.PACKAGE_NAME }}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}"
- name: Upload apisix-dashboard Artifact
if: ${{ env.TAG_TYPE == 'dashboard' }}
uses: actions/upload-artifact@v4.0.0
env:
PACKAGE_NAME: apisix-dashboard-${{ env.TAG_VERSION }}-0.el7.${{ env.ARCH }}.rpm
with:
name: "${{ env.PACKAGE_NAME }}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}"
- name: RPM repo deps init
env:
TENCENT_COS_SECRETID: ${{ secrets.TENCENT_COS_SECRETID }}
TENCENT_COS_SECRETKEY: ${{ secrets.TENCENT_COS_SECRETKEY }}
run: |
sudo pip install coscmd
sudo -E ./utils/publish-rpm.sh init_cos_utils
- name: RPM repo init for redhat
run: |
sudo -E ./utils/publish-rpm.sh repo_init
sudo -E ./utils/publish-rpm.sh repo_clone
- name: RPM repo package update
env:
GPG_NAME: ${{ secrets.GPG_NAME }}
GPG_MAIL: ${{ secrets.GPG_MAIL }}
run: |
echo "${{ secrets.RPM_GPG_PRIV_KEY }}" >> /tmp/rpm-gpg-publish.private
echo "${{ secrets.RPM_GPG_PASSPHRASE }}" >> /tmp/rpm-gpg-publish.passphrase
echo "${{ secrets.RPM_GPG_PUB_KEY }}" >> /tmp/rpm-gpg-publish.public
sudo -E ./utils/publish-rpm.sh rpm_gpg_sign
sudo -E ./utils/publish-rpm.sh repo_package_sync
- name: RPM repo backup for redhat
run: |
sudo -E ./utils/publish-rpm.sh repo_backup
- name: RPM repo refresh for redhat
run: |
sudo -E ./utils/publish-rpm.sh repo_repodata_rebuild
sudo -E ./utils/publish-rpm.sh repo_upload
- name: RPM repo publish for redhat
run: |
sudo -E ./utils/publish-rpm.sh repo_publish