diff --git a/.github/workflows/release-apisix-runtime.yml b/.github/workflows/release-apisix-runtime.yml new file mode 100644 index 000000000..3e9f78fe2 --- /dev/null +++ b/.github/workflows/release-apisix-runtime.yml @@ -0,0 +1,71 @@ +name: Release apisix-runtime + +on: + release: + types: + - published + workflow_dispatch: + inputs: + version: + description: "apisix-runtime version to release" + required: true + +permissions: + contents: write + +jobs: + release: + name: Release + if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'apisix-runtime/') + timeout-minutes: 90 + env: + RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || format('apisix-runtime/{0}', github.event.inputs.version) }} + strategy: + fail-fast: false + matrix: + platform: + - runner: ubuntu-24.04 + arch: amd64 + build_arch: linux/amd64 + - runner: ubuntu-24.04-arm + arch: arm64 + build_arch: linux/arm64/v8 + runs-on: ${{ matrix.platform.runner }} + steps: + - name: Resolve release version + run: | + version="${RELEASE_TAG#apisix-runtime/}" + if [[ "$version" == "$RELEASE_TAG" || ! "$version" =~ ^[0-9A-Za-z._-]+$ ]]; then + echo "invalid release tag: $RELEASE_TAG" >&2 + exit 1 + fi + echo "VERSION=$version" >> "$GITHUB_ENV" + + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + ref: ${{ env.RELEASE_TAG }} + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y make ruby ruby-dev rubygems build-essential + + - name: Build apisix-runtime deb + run: | + make package type=deb app=apisix-runtime runtime_version="${VERSION}" image_base=debian image_tag=bookworm-slim arch=${{ matrix.platform.build_arch }} + + - name: Build apisix-runtime-debug deb + run: | + make package type=deb app=apisix-runtime runtime_version="${VERSION}" image_base=debian image_tag=bookworm-slim arch=${{ matrix.platform.build_arch }} build_latest=latest artifact=apisix-runtime-debug + + - name: Upload release assets + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release view "$RELEASE_TAG" >/dev/null + gh release upload "$RELEASE_TAG" \ + "./output/apisix-runtime_${VERSION}-0~debianbookworm-slim_${{ matrix.platform.arch }}.deb" \ + "./output/apisix-runtime-debug_${VERSION}-0~debianbookworm-slim_${{ matrix.platform.arch }}.deb" \ + --clobber diff --git a/Makefile b/Makefile index 9f1d58a89..dc67e5f8a 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ local_code_path=0 openresty="apisix-runtime" artifact="0" runtime_version=0 +build_latest= apisix_repo="https://github.com/apache/apisix" apisix_runtime_repo="https://github.com/api7/apisix-build-tools.git" dashboard_repo="https://github.com/apache/apisix-dashboard" @@ -99,6 +100,7 @@ define build_runtime --build-arg RUNTIME_VERSION=$(runtime_version) \ --build-arg IMAGE_BASE=$(image_base) \ --build-arg IMAGE_TAG=$(image_tag) \ + --build-arg BUILD_LATEST=$(build_latest) \ --build-arg CODE_PATH=$(4) \ --platform $(arch) \ -f ./dockerfiles/Dockerfile.$(2).$(3) . @@ -111,6 +113,7 @@ define build_runtime --build-arg RUNTIME_VERSION=$(runtime_version) \ --build-arg IMAGE_BASE=$(image_base) \ --build-arg IMAGE_TAG=$(image_tag) \ + --build-arg BUILD_LATEST=$(build_latest) \ --build-arg CODE_PATH=$(4) \ --load \ --cache-from=$(cache_from) \ diff --git a/package-apisix-runtime.sh b/package-apisix-runtime.sh index f63f8108c..5a82eb96e 100755 --- a/package-apisix-runtime.sh +++ b/package-apisix-runtime.sh @@ -37,5 +37,5 @@ fi if [ "$PACKAGE_TYPE" == "deb" ]; then # Rename deb file with adding $DIST section - mv /output/apisix-runtime_"${RUNTIME_VERSION}"-"${ITERATION}"_"${PACKAGE_ARCH}".deb /output/apisix-runtime_"${RUNTIME_VERSION}"-"${ITERATION}"~"${dist}"_"${PACKAGE_ARCH}".deb + mv /output/"${artifact}"_"${RUNTIME_VERSION}"-"${ITERATION}"_"${PACKAGE_ARCH}".deb /output/"${artifact}"_"${RUNTIME_VERSION}"-"${ITERATION}"~"${dist}"_"${PACKAGE_ARCH}".deb fi