diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 4dd3939..b2ec566 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -9,6 +9,29 @@ on: - main jobs: + download_urls: + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macOS-latest ] + sdk: + - version: '4.0' + stage: 'Release' + - version: '4.1' + stage: 'Release' + - version: '5.0' + stage: 'Beta1' + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup SDK + id: initial-setup + uses: ./ + with: + cache: false + version: ${{ matrix.sdk.version }} + stage: ${{ matrix.sdk.stage }} build: strategy: matrix: diff --git a/action.yml b/action.yml index 0fec160..1c4a27e 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,10 @@ inputs: description: 'OpenHarmony SDK release version' required: false default: '4.1' + stage: + description: 'SDK stage, e.g. `Release` or `Beta1`' + required: false + default: 'Release' cache: description: "Whether to cache the SDK or not" required: false @@ -58,6 +62,7 @@ runs: if: ${{ inputs.cache != 'true' || steps.cache.outputs.cache-hit != 'true' }} env: INPUT_VERSION: "${{ inputs.version }}" + INPUT_STAGE: "${{ inputs.stage }}" INPUT_COMPONENTS: "${{ inputs.components }}" INPUT_FIXUP_PATH: ${{ inputs.fixup-path }} - name: Set Outputs diff --git a/install_ohos_sdk.sh b/install_ohos_sdk.sh index 78b80c3..1e44212 100755 --- a/install_ohos_sdk.sh +++ b/install_ohos_sdk.sh @@ -3,6 +3,7 @@ set -eu : "${INPUT_VERSION:?INPUT_VERSION needs to be set}" +: "${INPUT_STAGE:?INPUT_STAGE needs to be set}" # https://repo.huaweicloud.com/openharmony/os/4.0-Release/ohos-sdk-windows_linux-public.tar.gz @@ -25,7 +26,7 @@ else echo "Unknown OS type. The OHOS SDK is only available for Windows, Linux and macOS." fi -DOWNLOAD_URL="${URL_BASE}/${INPUT_VERSION}-Release/${OS_FILENAME}" +DOWNLOAD_URL="${URL_BASE}/${INPUT_VERSION}-${INPUT_STAGE}/${OS_FILENAME}" echo "Downloading OHOS SDK from ${DOWNLOAD_URL}" @@ -50,14 +51,14 @@ else fi IFS=";" read -ra COMPONENTS <<< "${INPUT_COMPONENTS}" -for COMPONENT in ${COMPONENTS[@]} +for COMPONENT in "${COMPONENTS[@]}" do echo "Extracting component ${COMPONENT}" - unzip ${COMPONENT}-*.zip - API_VERSION=$(cat ${COMPONENT}/oh-uni-package.json | jq -r '.apiVersion') + unzip "${COMPONENT}"-*.zip + API_VERSION=$(cat "${COMPONENT}/oh-uni-package.json" | jq -r '.apiVersion') if [ "$INPUT_FIXUP_PATH" = "true" ]; then - mkdir -p ${API_VERSION} - mv ${COMPONENT} "${API_VERSION}/" + mkdir -p "${API_VERSION}" + mv "${COMPONENT}" "${API_VERSION}/" fi done rm ./*.zip