Skip to content

Commit

Permalink
add rpm arm
Browse files Browse the repository at this point in the history
  • Loading branch information
AlinsRan committed Jan 30, 2024
1 parent 8224150 commit d094137
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 1 deletion.
206 changes: 206 additions & 0 deletions .github/workflows/publish-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
name: Build and Publish RPM Package

on:
push:

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
runs-on: ubuntu-22.04
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: aarch64

steps:
- name: Check out code
uses: actions/[email protected]
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
shell: bash
run: |
echo "TAG_VERSION=3.8.0" >> "$GITHUB_ENV"
- name: Extract Tags Type
shell: bash
run: |
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/${APISIX_TAG_VERSION}/.requirements
source .requirements
# build apisix
make package type=rpm app=apisix openresty=apisix-runtime runtime_version=${APISIX_RUNTIME} checkout=${APISIX_TAG_VERSION} version=${APISIX_TAG_VERSION} image_base=centos image_tag=7
make package type=rpm app=apisix openresty=apisix-runtime runtime_version=${APISIX_RUNTIME} checkout=${APISIX_TAG_VERSION} version=${APISIX_TAG_VERSION} image_base=centos image_tag=8
make package type=rpm app=apisix openresty=apisix-runtime runtime_version=${APISIX_RUNTIME} checkout=${APISIX_TAG_VERSION} version=${APISIX_TAG_VERSION} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6
mv ./output/apisix-${APISIX_TAG_VERSION}-0.{el7,el8,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=centos image_tag=7
make package type=rpm app=apisix-base checkout=${APISIX_BASE_TAG_VERSION} version=${APISIX_BASE_TAG_VERSION} image_base=centos image_tag=8
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.{el7,el8,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=centos image_tag=7
make package type=rpm app=apisix-runtime checkout=${APISIX_RUNTIME_TAG_VERSION} version=${APISIX_RUNTIME_TAG_VERSION} image_base=centos image_tag=8
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.{el7,el8,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
make package type=rpm app=dashboard checkout=${APISIX_DASHBOARD_TAG_VERSION} version=${APISIX_DASHBOARD_TAG_VERSION} image_base=centos image_tag=7
make package type=rpm app=dashboard checkout=${APISIX_DASHBOARD_TAG_VERSION} version=${APISIX_DASHBOARD_TAG_VERSION} image_base=centos image_tag=8
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/[email protected]
env:
PACKAGE_NAME: apisix-${{ env.TAG_VERSION }}-0.ubi8.6.${{ env.ARCH }}.rpm
with:
name: "${PACKAGE_NAME}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${PACKAGE_NAME}"

- name: Upload apisix Artifact for Centos
if: ${{ env.TAG_TYPE == 'apisix' }}
uses: actions/[email protected]
env:
PACKAGE_NAME: apisix-${{ env.TAG_VERSION }}-0.el7.${{ env.ARCH }}.rpm
with:
name: "${PACKAGE_NAME}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${PACKAGE_NAME}"

- name: Upload apisix-base Artifact for Redhat
if: ${{ env.TAG_TYPE == 'apisix-base' }}
uses: actions/[email protected]
env:
PACKAGE_NAME: apisix-base-${{ env.TAG_VERSION }}-0.ubi8.6.${{ env.ARCH }}.rpm
with:
name: "${PACKAGE_NAME}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${PACKAGE_NAME}"

- name: Upload apisix-base Artifact for Centos
if: ${{ env.TAG_TYPE == 'apisix-base' }}
uses: actions/[email protected]
env:
PACKAGE_NAME: apisix-base-${{ env.TAG_VERSION }}-0.el7.${{ env.ARCH }}.rpm
with:
name: "${PACKAGE_NAME}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${PACKAGE_NAME}"

- name: Upload apisix-runtime Artifact for Redhat
if: ${{ env.TAG_TYPE == 'apisix-runtime' }}
uses: actions/[email protected]
env:
PACKAGE_NAME: apisix-runtime-${{ env.TAG_VERSION }}-0.ubi8.6.${{ env.ARCH }}.rpm
with:
name: "${PACKAGE_NAME}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${PACKAGE_NAME}"

- name: Upload apisix-runtime Artifact for Centos
if: ${{ env.TAG_TYPE == 'apisix-runtime' }}
uses: actions/[email protected]
env:
PACKAGE_NAME: apisix-runtime-${{ env.TAG_VERSION }}-0.el7.${{ env.ARCH }}.rpm
with:
name: "${PACKAGE_NAME}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${PACKAGE_NAME}"

- name: Upload apisix-dashboard Artifact
if: ${{ env.TAG_TYPE == 'dashboard' }}
uses: actions/[email protected]
env:
PACKAGE_NAME: apisix-dashboard-${{ env.TAG_VERSION }}-0.el7.${{ env.ARCH }}.rpm
with:
name: "${PACKAGE_NAME}"
path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${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 centos and 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 centos and redhat
run: |
sudo -E ./utils/publish-rpm.sh repo_backup
- name: RPM repo refresh for centos and redhat
run: |
sudo -E ./utils/publish-rpm.sh repo_repodata_rebuild
sudo -E ./utils/publish-rpm.sh repo_upload
5 changes: 5 additions & 0 deletions .github/workflows/publish-deb-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,8 @@ jobs:
sudo -E ./utils/publish-deb.sh repo_rebuild
sudo -E ./utils/publish-deb.sh repo_ci_upload
- name: DEB repo publish for debian
env:
UPLOAD_TARGET_FILE: "${{ env.TAG_TYPE }}_${{ env.TAG_VERSION }}-0_${{ env.ARCH }}.deb"
run: |
sudo -E ./utils/publish-deb.sh repo_upload
2 changes: 1 addition & 1 deletion utils/publish-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ repo_ci_upload)
func_dists_upload_ci_repo "/tmp/freight/cache/dists" "${VAR_COS_BUCKET_CI}" "${VAR_OS}"
;;
repo_upload)
func_deb_upload "${VAR_DEB_WORKBENCH_DIR}" "${VAR_COS_BUCKET_REPO}" "${VAR_OS}" "${VAR_CODENAME}"
func_deb_upload "${VAR_DEB_WORKBENCH_DIR}" "${VAR_COS_BUCKET_CI}" "${VAR_OS}" "${VAR_CODENAME}"
;;
repo_publish)
func_repo_publish "${VAR_COS_BUCKET_CI}" "${VAR_COS_BUCKET_REPO}" "${VAR_OS}"
Expand Down

0 comments on commit d094137

Please sign in to comment.