Skip to content
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-offline-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,149 +49,149 @@

jobs:
build-offline-package:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
platform:
- amd64
- arm64

steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true

- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set version and platform variables
id: set-vars
run: |
PLATFORM="${{ matrix.platform }}"
REF_TYPE="${{ github.ref_type }}"
REF_NAME="${{ github.ref_name }}"

if [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [ "$REF_TYPE" = "tag" ]; then
VERSION="$REF_NAME"
elif [ "$REF_TYPE" = "branch" ]; then
if [ "$REF_NAME" = "main" ]; then
VERSION="latest"
else
VERSION="${REF_NAME//\//-}"
fi
else
VERSION="latest"
fi

SOURCE_SUFFIX=""
FULL_SANDBOX_SUFFIX=""
INCLUDE_SOURCE="${{ inputs.include_source || false }}"
INCLUDE_FULL_SANDBOX="${{ inputs.include_full_sandbox || false }}"
IMAGE_SOURCE="${{ inputs.image_source || 'general' }}"
UPLOAD_TO_OBS="${{ (github.event_name == 'push' && github.ref_type == 'tag') || inputs.upload_to_obs }}"
if [ "$INCLUDE_SOURCE" = "true" ]; then
SOURCE_SUFFIX="-with-source"
fi
if [ "$INCLUDE_FULL_SANDBOX" = "true" ]; then
FULL_SANDBOX_SUFFIX="-with-full-sandbox"
fi

echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "platform=$PLATFORM" >> "$GITHUB_OUTPUT"
echo "include-source=$INCLUDE_SOURCE" >> "$GITHUB_OUTPUT"
echo "include-full-sandbox=$INCLUDE_FULL_SANDBOX" >> "$GITHUB_OUTPUT"
echo "image-source=$IMAGE_SOURCE" >> "$GITHUB_OUTPUT"
echo "upload_to_obs=$UPLOAD_TO_OBS" >> "$GITHUB_OUTPUT"
echo "package-name=nexent-${VERSION}-${PLATFORM}${SOURCE_SUFFIX}${FULL_SANDBOX_SUFFIX}" >> "$GITHUB_OUTPUT"

- name: Set deployment components
id: set-components
run: |
COMPONENTS="infrastructure,application,data-process,terminal"

echo "components=$COMPONENTS" >> "$GITHUB_OUTPUT"
echo "Selected deployment components: $COMPONENTS"

- name: Build offline package
run: |
chmod +x deploy/offline/build_offline_package.sh

./deploy/offline/build_offline_package.sh \
--version "${{ steps.set-vars.outputs.version }}" \
--platform "${{ steps.set-vars.outputs.platform }}" \
--output-dir ./offline-output \
--include-source "${{ steps.set-vars.outputs.include-source }}" \
--include-sandbox-full "${{ steps.set-vars.outputs.include-full-sandbox }}" \
--image-source "${{ steps.set-vars.outputs.image-source }}" \
--components "${{ steps.set-components.outputs.components }}" \
--target all \
--package-name "${{ steps.set-vars.outputs.package-name }}" \
--compress true

- name: Show offline package
run: |
PACKAGE_NAME="${{ steps.set-vars.outputs.package-name }}"

echo "Package directory created by build script: ./offline-output"
echo "GitHub Actions will publish the final downloadable artifact as ${PACKAGE_NAME}.zip"

du -sh ./offline-output
find ./offline-output -maxdepth 2 -type f | sort | head -50

- name: Authenticate to Huawei Cloud
if: ${{ steps.set-vars.outputs.upload_to_obs == 'true' }}
uses: huaweicloud/auth-action@v1.1.0
with:
access_key_id: ${{ secrets.HUAWEI_OBS_ACCESSKEY }}
secret_access_key: ${{ secrets.HUAWEI_OBS_SECRETKEY }}
region: 'ap-southeast-1'

- name: Upload to Huawei Cloud OBS
if: ${{ steps.set-vars.outputs.upload_to_obs == 'true' }}
uses: huaweicloud/obs-helper@v1.0.0
with:
bucket_name: 'modelengine-software'
local_file_path: './${{ steps.set-vars.outputs.package-name }}.zip'
obs_file_path: 'nexent/${{ steps.set-vars.outputs.package-name }}.zip'
operation_type: 'upload'

- name: Upload artifact
uses: actions/upload-artifact@v7
with:
path: './${{ steps.set-vars.outputs.package-name }}.zip'
if-no-files-found: error
retention-days: 30
archive: false

- name: Summary
run: |
echo ""
echo "========================================"
echo "Offline Package Build Summary"
echo "========================================"
echo "Version: ${{ steps.set-vars.outputs.version }}"
echo "Platform: ${{ steps.set-vars.outputs.platform }}"
echo "Package: ${{ steps.set-vars.outputs.package-name }}.zip"
echo "Note: the GitHub artifact zip contains the offline package contents directly."
echo "Components: ${{ steps.set-components.outputs.components }}"
echo "Include full sandbox: ${{ steps.set-vars.outputs.include-full-sandbox }}"
echo "Image source: ${{ steps.set-vars.outputs.image-source }}"
echo "Ref Type: ${{ github.ref_type }}"
echo "Ref Name: ${{ github.ref_name }}"
echo "========================================"
echo ""
echo "Package directory:"
ls -l .

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Loading