Merge pull request #1678 from EasyTier/ohpm
EasyTier Core / pre_job (push) Has been cancelled
EasyTier GUI / pre_job (push) Has been cancelled
EasyTier Mobile / pre_job (push) Has been cancelled
EasyTier OHOS / cargo_fmt_check (push) Has been cancelled
EasyTier OHOS / pre_job (push) Has been cancelled
EasyTier Test / pre_job (push) Has been cancelled
EasyTier Core / build_web (push) Has been cancelled
EasyTier Core / build (freebsd-13.2-x86_64, 13.2, ubuntu-22.04, x86_64-unknown-freebsd) (push) Has been cancelled
EasyTier Core / build (linux-aarch64, ubuntu-22.04, aarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-arm, ubuntu-22.04, arm-unknown-linux-musleabi) (push) Has been cancelled
EasyTier Core / build (linux-armhf, ubuntu-22.04, arm-unknown-linux-musleabihf) (push) Has been cancelled
EasyTier Core / build (linux-armv7, ubuntu-22.04, armv7-unknown-linux-musleabi) (push) Has been cancelled
EasyTier Core / build (linux-armv7hf, ubuntu-22.04, armv7-unknown-linux-musleabihf) (push) Has been cancelled
EasyTier Core / build (linux-loongarch64, ubuntu-24.04, loongarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-mips, ubuntu-22.04, mips-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-mipsel, ubuntu-22.04, mipsel-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-riscv64, ubuntu-22.04, riscv64gc-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-x86_64, ubuntu-22.04, x86_64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (macos-aarch64, macos-latest, aarch64-apple-darwin) (push) Has been cancelled
EasyTier Core / build (macos-x86_64, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
EasyTier Core / build (windows-arm64, windows-latest, aarch64-pc-windows-msvc) (push) Has been cancelled
EasyTier Core / build (windows-i686, windows-latest, i686-pc-windows-msvc) (push) Has been cancelled
EasyTier Core / build (windows-x86_64, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
EasyTier Core / core-result (push) Has been cancelled
EasyTier Core / magisk_build (push) Has been cancelled
EasyTier GUI / build-gui (linux-aarch64, aarch64-unknown-linux-gnu, ubuntu-22.04, aarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier GUI / build-gui (linux-x86_64, x86_64-unknown-linux-gnu, ubuntu-22.04, x86_64-unknown-linux-musl) (push) Has been cancelled
EasyTier GUI / build-gui (macos-aarch64, aarch64-apple-darwin, macos-latest, aarch64-apple-darwin) (push) Has been cancelled
EasyTier GUI / build-gui (macos-x86_64, x86_64-apple-darwin, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
EasyTier GUI / build-gui (windows-arm64, aarch64-pc-windows-msvc, windows-latest, aarch64-pc-windows-msvc) (push) Has been cancelled
EasyTier GUI / build-gui (windows-i686, i686-pc-windows-msvc, windows-latest, i686-pc-windows-msvc) (push) Has been cancelled
EasyTier GUI / build-gui (windows-x86_64, x86_64-pc-windows-msvc, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
EasyTier GUI / gui-result (push) Has been cancelled
EasyTier Mobile / build-mobile (android, ubuntu-22.04, android) (push) Has been cancelled
EasyTier Mobile / mobile-result (push) Has been cancelled
EasyTier OHOS / build-ohos (push) Has been cancelled
EasyTier Test / test (push) Has been cancelled

[鸿蒙] 在流水线中增加上传中心仓与上传华为云私仓流程,增加华为云流水线Webhook
This commit is contained in:
韩嘉乐
2025-12-16 12:06:19 +08:00
committed by GitHub
4 changed files with 209 additions and 24 deletions
+55 -21
View File
@@ -56,38 +56,43 @@ jobs:
wget \
unzip \
git \
pkg-config
pkg-config curl libgl1-mesa-dev expect
sudo apt-get clean
- name: Download and extract native SDK
working-directory: ../../../
- name: Get easytier version
run: |
echo $PWD
wget -q \
https://github.com/openharmony-rs/ohos-sdk/releases/download/v5.1.0/ohos-sdk-windows_linux-public.tar.gz.aa
wget -q \
https://github.com/openharmony-rs/ohos-sdk/releases/download/v5.1.0/ohos-sdk-windows_linux-public.tar.gz.ab
cat ohos-sdk-windows_linux-public.tar.gz.aa ohos-sdk-windows_linux-public.tar.gz.ab > sdk.tar.gz
echo "Extracting native..."
mkdir sdk
tar -xzf sdk.tar.gz ohos-sdk/linux/native-linux-x64-5.1.0.107-Release.zip
tar -xzf sdk.tar.gz ohos-sdk/linux/toolchains-linux-x64-5.1.0.107-Release.zip
unzip -qq ohos-sdk/linux/native-linux-x64-5.1.0.107-Release.zip -d sdk
unzip -qq ohos-sdk/linux/toolchains-linux-x64-5.1.0.107-Release.zip -d sdk
ls -la sdk/native/llvm/bin/
rm -rf ohos-sdk-windows_linux-public.tar.gz.aa ohos-sdk-windows_linux-public.tar.gz.ab ohos-sdk/
EASYTIER_CARGO_VERSION=$(cargo metadata --format-version 1 --no-deps --manifest-path easytier/Cargo.toml \
| jq -r '.packages[0].version')
EASYTIER_GIT_HASH=$(git -C easytier rev-parse --short HEAD)
EASYTIER_VERSION="${EASYTIER_CARGO_VERSION}-${EASYTIER_GIT_HASH}"
echo "EASYTIER_VERSION=${EASYTIER_VERSION}" >> $GITHUB_ENV
cd ./easytier-contrib/easytier-ohrs/package
jq --arg v "$EASYTIER_VERSION" '.version = $v' oh-package.json5 > oh-package.tmp.json5
mv oh-package.tmp.json5 oh-package.json5
- name: Generate CHANGELOG.md for current commit
working-directory: ./easytier-contrib/easytier-ohrs/package
run: |
{
echo "## easytier-ohrs ${EASYTIER_VERSION}"
echo
git log -1 --pretty=format:"- %s"
echo
} > CHANGELOG.md
- name: Setup HarmonyOS CLI tools
uses: ErBWs/setup-ohos@v1
- name: Download and Extract Custom SDK
run: |
wget https://github.com/FrankHan052176/Easytier-OHOS-sdk/releases/download/v1/ohos-sdk.zip -O /tmp/ohos-sdk.zip
sudo unzip -o /tmp/ohos-sdk.zip -d /tmp/custom-sdk
sudo cp -rf /tmp/custom-sdk/linux/native/* $HOME/sdk/native
echo "Custom SDK files deployed to $HOME/sdk/native"
ls -a $HOME/sdk/native
sudo cp -rf /tmp/custom-sdk/linux/native/* $OHOS_NDK_HOME/native
echo "Custom SDK files deployed to $OHOS_NDK_HOME/native"
ls -a $OHOS_NDK_HOME/native
- name: Setup build environment
run: |
echo "OHOS_NDK_HOME=$HOME/sdk" >> $GITHUB_ENV
echo "TARGET_ARCH=aarch64-linux-ohos" >> $GITHUB_ENV
- name: Create clang wrapper script
@@ -118,6 +123,35 @@ jobs:
ohrs artifact
mv package.har easytier-ohrs.har
- name: Publish To Center Ohpm
working-directory: ./easytier-contrib/easytier-ohrs
env:
OHPM_PUBLISH_CODE: ${{ secrets.OHPM_PUBLISH_CODE }}
OHPM_PRIVATE_KEY: ${{ secrets.OHPM_PRIVATE_KEY }}
OHPM_KEY_PASSPHRASE: ${{ secrets.OHPM_KEY_PASSPHRASE }}
run: |
ohpm config set publish_id "$OHPM_PUBLISH_CODE"
ohpm config set publish_registry https://ohpm.openharmony.cn/ohpm
TMP_DIR=$(mktemp -d)
PRIVATE_KEY_FILE="$TMP_DIR/private_key"
printf '%s' "$OHPM_PRIVATE_KEY" > "$PRIVATE_KEY_FILE"
chmod 600 "$PRIVATE_KEY_FILE"
ohpm config set key_path $PRIVATE_KEY_FILE
unzip ohpm_crypto.zip -d /home/runner/work/
ohpm config set crypto_path /home/runner/work/ohpm_crypto
chmod 755 /home/runner/work/ohpm_crypto/*
PASSPHRASE="$(printf '%s' "$OHPM_KEY_PASSPHRASE" | tr -d '\r\n')"
ohpm config set key_passphrase "$PASSPHRASE"
ohpm publish easytier-ohrs.har
- name: Publish To Private Ohpm
working-directory: ./easytier-contrib/easytier-ohrs
run: |
printf '%s' "${{ secrets.CODEARTS_PRIVATE_OHPM }}" > ~/.ohpm/.ohpmrc
ohpm config set strict_ssl false
ohpm publish easytier-ohrs.har
curl --header "Content-Type: application/json" --request POST --data "{}" ${{ secrets.CODEARTS_WEBHOOKS }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Binary file not shown.
@@ -10,10 +10,151 @@ ohpm install easytier-ohrs
## API
### collectNetworkInfos
```ts
// todo
collectNetworkInfos(): Array<KeyValuePair>
````
---
### collectRunningNetwork
```ts
collectRunningNetwork(): Array<string>
```
获取当前正在运行的网络实例名称列表。
---
### convertTomlToNetworkConfig
```ts
convertTomlToNetworkConfig(cfgStr: string): string
```
将 TOML 配置转换为 NetworkConfig。
* `cfgStr`TOML 配置内容
---
### defaultNetworkConfig
```ts
defaultNetworkConfig(): string
```
获取默认的网络配置(JSON 字符串),用于转换为object进行赋值。
---
### easytierVersion
```ts
easytierVersion(): string
```
获取 EasyTier 当前版本号。
---
### hilogGlobalOptions
```ts
hilogGlobalOptions(domain: number, tag: string): void
```
设置全局日志选项。
* `domain`:日志域 ID
* `tag`:日志标签
---
### initPanicHook
```ts
initPanicHook(): void
```
初始化 panic 钩子,用于将Rust侧的panic输出到hilog中,请先通过 hilogGlobalOptions 设置hilog的参数。
---
### initTracingSubscriber
```ts
initTracingSubscriber(): void
```
初始化 tracing 日志订阅器,用于将Rust侧日志同步输出到hilog中,请先通过 hilogGlobalOptions 设置hilog的参数。
---
### isRunningNetwork
```ts
isRunningNetwork(instId: string): boolean
```
判断指定网络实例是否正在运行。
* `instId`:网络实例 ID
---
### parseNetworkConfig
```ts
parseNetworkConfig(cfgJson: string): boolean
```
校验网络配置(JSON 格式)是否合法。
* `cfgJson`:网络配置内容
---
### runNetworkInstance
```ts
runNetworkInstance(cfgJson: string): boolean
```
启动网络实例。
* `cfgJson`:网络配置(JSON
---
### setTunFd
```ts
setTunFd(instId: string, fd: number): boolean
```
为指定网络实例设置 TUN 设备文件描述符。
* `instId`:网络实例 ID
* `fd`TUN 设备文件描述符
---
### stopNetworkInstance
```ts
stopNetworkInstance(instNames: Array<string>): void
```
停止指定的网络实例。
* `instNames`:网络实例名称列表
## Usage
```ts
@@ -2,9 +2,19 @@
"license": "LGPL-3.0",
"author": "easytier",
"name": "easytier-ohrs",
"description": "",
"description": "EasyTier for OpenHarmonyOS",
"main": "index.ets",
"version": "0.0.1",
"types": "libs/index.d.ts",
"dependencies": {}
"dependencies": {},
"compatibleSdkVersion": "17",
"compatibleSdkType": "OpenHarmony",
"obfuscated": false,
"nativeComponents": [
{
"name": "libeasytier_ohrs.so",
"compatibleSdkVersion": "17",
"compatibleSdkType": "OpenHarmony"
}
]
}