Skip to content

Commit 4c58b69

Browse files
authored
ci: add manual trigger to release apisix-runtime debian package (#399)
* ci: add manual trigger to build apisix-runtime debian package (#396) * ci: add manual trigger to build apisix-runtime debian package * rename * install dependencies * rename * change arch * change * use env.ARCH * set github env * add image arch * set default * use arch everywhere * use arm64v8 image * use linux/arm64 * use matrix.platform * fix * use same image diff platform * fix * use image name * use debian not ubuntu * a * make release * add tag name * use matrix.platform.arch * Update package-apisix-runtime-deb-openresty-1.21.yml (#398) - change tag name - add pull_request trigger * Update package-apisix-runtime-deb-openresty-1.21.yml (#400) * Update package-apisix-runtime-deb-openresty-1.21.yml (#401)
1 parent 25c106a commit 4c58b69

File tree

2 files changed

+67
-2
lines changed

2 files changed

+67
-2
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: package apisix-runtime deb for debianbullseye-slim with openresty 1.21
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag_name:
7+
description: 'Tag name for the release'
8+
required: true
9+
default: ''
10+
11+
jobs:
12+
build:
13+
timeout-minutes: 60
14+
env:
15+
BUILD_APISIX_RUNTIME_VERSION: 1.1.3
16+
strategy:
17+
matrix:
18+
platform:
19+
- runner: ubuntu-22.04
20+
arch: amd64
21+
- runner: buildjet-2vcpu-ubuntu-2204-arm
22+
arch: arm64
23+
runs-on: ${{ matrix.platform.runner }}
24+
steps:
25+
- uses: actions/checkout@v2
26+
with:
27+
ref: openresty/1.21.4
28+
29+
- name: Check arch
30+
run: |
31+
echo "ARCH: ${{ matrix.platform.arch }}"
32+
33+
- name: Install dependencies
34+
run: |
35+
sudo apt-get install -y make ruby ruby-dev rubygems build-essential
36+
37+
- name: Build apisix-runtime deb
38+
run: |
39+
if [ "${{ matrix.platform.arch }}" == "arm64" ]; then
40+
make package type=deb app=apisix-runtime runtime_version=${BUILD_APISIX_RUNTIME_VERSION} image_base=debian image_tag=bullseye-slim arch=linux/arm64/v8
41+
else
42+
make package type=deb app=apisix-runtime runtime_version=${BUILD_APISIX_RUNTIME_VERSION} image_base=debian image_tag=bullseye-slim arch=linux/amd64
43+
fi
44+
45+
- name: Release with Notes
46+
uses: softprops/action-gh-release@v1
47+
with:
48+
tag_name: ${{ github.event.inputs.tag_name }}
49+
body: |
50+
Release apisix-runtime ${{ github.event.inputs.tag_name }}
51+
files: |
52+
./output/apisix-runtime_${{ env.BUILD_APISIX_RUNTIME_VERSION }}-0~debianbullseye-slim_${{ matrix.platform.arch }}.deb
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ ifeq ($(type), deb)
3535
image_base="ubuntu"
3636
image_tag="20.04"
3737
endif
38-
38+
# Set arch to linux/amd64 if it's not defined
39+
arch ?= linux/amd64
3940
buildx=0
4041
cache_from=type=local,src=/tmp/.buildx-cache
4142
cache_to=type=local,dest=/tmp/.buildx-cache
@@ -54,6 +55,7 @@ define build
5455
--build-arg IMAGE_BASE=$(image_base) \
5556
--build-arg IMAGE_TAG=$(image_tag) \
5657
--build-arg CODE_PATH=$(4) \
58+
--platform $(arch) \
5759
-f ./dockerfiles/Dockerfile.$(2).$(3) .
5860
endef
5961
else
@@ -69,6 +71,7 @@ define build
6971
--load \
7072
--cache-from=$(cache_from) \
7173
--cache-to=$(cache_to) \
74+
--platform $(arch) \
7275
-f ./dockerfiles/Dockerfile.$(2).$(3) .
7376
endef
7477
endif
@@ -87,6 +90,7 @@ define build_runtime
8790
--build-arg IMAGE_BASE=$(image_base) \
8891
--build-arg IMAGE_TAG=$(image_tag) \
8992
--build-arg CODE_PATH=$(4) \
93+
--platform $(arch) \
9094
-f ./dockerfiles/Dockerfile.$(2).$(3) .
9195
endef
9296
else
@@ -101,6 +105,7 @@ define build_runtime
101105
--load \
102106
--cache-from=$(cache_from) \
103107
--cache-to=$(cache_to) \
108+
--platform $(arch) \
104109
-f ./dockerfiles/Dockerfile.$(2).$(3) .
105110
endef
106111
endif
@@ -118,6 +123,7 @@ define build-image
118123
--build-arg OPENRESTY_NAME=$(4) \
119124
--build-arg OPENRESTY_VERSION=$(5) \
120125
--build-arg CODE_PATH=$(6) \
126+
--platform $(arch) \
121127
-f ./dockerfiles/Dockerfile.$(2).$(3) .
122128
endef
123129
else
@@ -129,6 +135,7 @@ define build-image
129135
--load \
130136
--cache-from=$(cache_from) \
131137
--cache-to=$(cache_to) \
138+
--platform $(arch) \
132139
-f ./dockerfiles/Dockerfile.$(2).$(3) .
133140
endef
134141
endif
@@ -145,6 +152,7 @@ define package
145152
--build-arg PACKAGE_TYPE=$(2) \
146153
--build-arg OPENRESTY=$(openresty) \
147154
--build-arg ARTIFACT=$(artifact) \
155+
--platform $(arch) \
148156
-f ./dockerfiles/Dockerfile.package.$(1) .
149157
docker run -d --rm --name output --net="host" apache/$(1)-packaged-$(2):$(version)
150158
docker cp output:/output ${PWD}
@@ -164,6 +172,7 @@ define package_runtime
164172
--build-arg PACKAGE_TYPE=$(2) \
165173
--build-arg OPENRESTY=$(openresty) \
166174
--build-arg ARTIFACT=$(artifact) \
175+
--platform $(arch) \
167176
-f ./dockerfiles/Dockerfile.package.$(1) .
168177
docker run -d --rm --name output --net="host" apache/$(1)-packaged-$(2):$(runtime_version)
169178
docker cp output:/output ${PWD}
@@ -290,13 +299,14 @@ package-apisix-base-deb:
290299
.PHONY: build-fpm
291300
ifneq ($(buildx), True)
292301
build-fpm:
293-
docker build -t api7/fpm - < ./dockerfiles/Dockerfile.fpm
302+
docker build --platform $(arch) -t api7/fpm - < ./dockerfiles/Dockerfile.fpm
294303
else
295304
build-fpm:
296305
docker buildx build \
297306
--load \
298307
--cache-from=$(cache_from) \
299308
--cache-to=$(cache_to) \
309+
--platform $(arch) \
300310
-t api7/fpm - < ./dockerfiles/Dockerfile.fpm
301311
endif
302312

0 commit comments

Comments
 (0)