diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml new file mode 100644 index 0000000..6bab4de --- /dev/null +++ b/.github/workflows/Release.yml @@ -0,0 +1,29 @@ +name: Mirror SDK + +on: + push: + tags: + - "v*.*" +jobs: + build: + strategy: + matrix: + artifact_name: + - ohos-sdk-windows_linux-public.tar.gz + - L2-SDK-MAC-M1-PUBLIC.tar.gz + - ohos-sdk-mac-public.tar.gz + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Download OpenHarmony SDK + run: download_sdk.sh + shell: bash + env: + # Relies on this job only running on tags! + INPUT_VERSION_TAG: "${{ github.ref_name }}" + INPUT_FILENAME: ${{ matrix.artifact_name}} + - name: Publish release + id: check-tag + run: | + gh release create ${{github.ref_name}} --notes "OpenHarmony SDK mirror release for ${{github.ref_name}}" ${{ matrix.artifact_name}} ${{ matrix.artifact_name}}.sha256 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..239aff6 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# OpenHarmony SDK mirror + +The OpenHarmony SDK is available for download via links in the OpenHarmony release notes. +However, the speed of these downloads can often be too slow for use in CI environments. +Hence, this repository provides a mirror of the released OpenHarmony SDKs, allowing quick downloads +in Github actions. diff --git a/download_sdk.sh b/download_sdk.sh new file mode 100644 index 0000000..3165c0f --- /dev/null +++ b/download_sdk.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Script to download an upstream SDK release + +set -eu + +: "${INPUT_VERSION_TAG:?INPUT_VERSION_TAG needs to be set}" +: "${INPUT_FILENAME:?INPUT_FILENAME needs to be set}" + +VERSION="${INPUT_VERSION_TAG:1}" + +# https://repo.huaweicloud.com/openharmony/os/4.0-Release/ohos-sdk-windows_linux-public.tar.gz + +URL_BASE="https://repo.huaweicloud.com/openharmony/os" + +DOWNLOAD_URL="${URL_BASE}/${VERSION}-Release/${INPUT_FILENAME}" + +echo "Downloading OHOS SDK from ${DOWNLOAD_URL}" + +curl --fail -L --remote-name "${DOWNLOAD_URL}" +curl --fail -L --remote-name "${DOWNLOAD_URL}.sha256" + +if ! sha256sum --quiet -c "${INPUT_FILENAME}.sha256"; then + echo "Error verifying sha256 of ${INPUT_FILENAME}" + exit 1 +fi +