Skip to content

Commit

Permalink
Add release mirror CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwe committed Oct 5, 2024
1 parent 5466e0d commit 9bfd69e
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Mirror SDK

on:
push:
tags:
- "v*.*"
jobs:
download:
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: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name}}
path: ${{ matrix.artifact_name}}*
compression-level: 0

create_release:
permissions: write-all
runs-on: ubuntu-latest
needs: ["download"]
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- run: ls -la
- name: Publish release
id: publish-release
run: |
artifacts=(./*)
gh release create ${{github.ref_name}} --notes "OpenHarmony SDK mirror release for ${{github.ref_name}}" "${artifacts[@]}"
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
23 changes: 23 additions & 0 deletions download_sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# Script to download an upstream SDK release

set -eux

: "${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"

echo "$(cat "${INPUT_FILENAME}".sha256) ${INPUT_FILENAME}" | sha256sum --check --status

0 comments on commit 9bfd69e

Please sign in to comment.