Skip to content

Build DDNSTO Packages #28

Build DDNSTO Packages

Build DDNSTO Packages #28

Workflow file for this run

name: Build DDNSTO Packages
on:
workflow_dispatch:
inputs:
build_type:
description: '包格式'
required: true
default: 'all'
type: choice
options:
- all
- apk_only
- ipk_only
ddnsto_type:
description: 'DDNSTO 类型'
required: true
default: 'all'
type: choice
options:
- all
- standard
- lite
arch_aarch64:
description: 'aarch64_generic'
required: true
default: true
type: boolean
arch_arm:
description: 'arm_cortex-a9'
required: true
default: true
type: boolean
arch_x86_64:
description: 'x86_64'
required: true
default: true
type: boolean
arch_mipsel:
description: 'mipsel_24kc'
required: true
default: true
type: boolean
push:
tags:
- 'v*'
permissions:
contents: write
env:
# 强制使用 Node.js 24,避免弃用警告
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
# 构建矩阵配置
setup:
runs-on: ubuntu-latest
outputs:
archs: ${{ steps.setup.outputs.archs }}
ddnsto_types: ${{ steps.setup.outputs.ddnsto_types }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup matrix
id: setup
run: |
# 设置架构列表
if [ "${{ github.event_name }}" == "push" ]; then
# push 事件构建全部架构
echo 'archs=["aarch64_generic","arm_cortex-a9","x86_64","mipsel_24kc"]' >> $GITHUB_OUTPUT
else
# 手动触发时根据选择的架构构建
archs="["
first=true
if [ "${{ github.event.inputs.arch_aarch64 }}" == "true" ]; then
if [ "$first" == "false" ]; then archs="$archs,"; fi
archs="$archs\"aarch64_generic\""
first=false
fi
if [ "${{ github.event.inputs.arch_arm }}" == "true" ]; then
if [ "$first" == "false" ]; then archs="$archs,"; fi
archs="$archs\"arm_cortex-a9\""
first=false
fi
if [ "${{ github.event.inputs.arch_x86_64 }}" == "true" ]; then
if [ "$first" == "false" ]; then archs="$archs,"; fi
archs="$archs\"x86_64\""
first=false
fi
if [ "${{ github.event.inputs.arch_mipsel }}" == "true" ]; then
if [ "$first" == "false" ]; then archs="$archs,"; fi
archs="$archs\"mipsel_24kc\""
first=false
fi
archs="$archs]"
# 如果没有选择任何架构,默认构建全部
if [ "$archs" == "[]" ]; then
archs='["aarch64_generic","arm_cortex-a9","x86_64","mipsel_24kc"]'
fi
echo "archs=$archs" >> $GITHUB_OUTPUT
echo "Selected architectures: $archs"
fi
# 设置 DDNSTO 类型列表
if [ "${{ github.event_name }}" == "push" ]; then
echo 'ddnsto_types=["standard"]' >> $GITHUB_OUTPUT
else
ddnsto_type_input="${{ github.event.inputs.ddnsto_type }}"
if [ "$ddnsto_type_input" == "all" ]; then
echo 'ddnsto_types=["standard","lite"]' >> $GITHUB_OUTPUT
echo "Selected DDNSTO types: [\"standard\",\"lite\"]"
else
echo "ddnsto_types=[\"$ddnsto_type_input\"]" >> $GITHUB_OUTPUT
echo "Selected DDNSTO type: [\"$ddnsto_type_input\"]"
fi
fi
# 构建 APK (SNAPSHOT)
build-apk:
name: Build APK ${{ matrix.arch }} (${{ matrix.ddnsto_type }})
runs-on: ubuntu-latest
needs: setup
if: github.event.inputs.build_type == 'apk_only' || github.event.inputs.build_type == 'all' || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
arch: ${{ fromJson(needs.setup.outputs.archs) }}
ddnsto_type: ${{ fromJson(needs.setup.outputs.ddnsto_types) }}
sdk:
- SNAPSHOT
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup variables
run: |
sudo timedatectl set-timezone 'Asia/Shanghai'
git config --global user.name 'actions'
git config --global user.email 'action@github.com'
echo build_time="$(date '+%Y-%m-%d')" >> "$GITHUB_ENV"
- name: Set DDNSTO_TYPE in Makefile
run: |
sed -i "s/DDNSTO_TYPE?=standard/DDNSTO_TYPE=${{ matrix.ddnsto_type }}/" ddnsto/Makefile
grep "DDNSTO_TYPE" ddnsto/Makefile | head -1
- name: Build Packages (APK)
uses: sbwml/openwrt-gh-action-sdk@go1.25
env:
ARCH: ${{ matrix.arch }}-${{ matrix.sdk }}
FEEDNAME: packages_ci
PACKAGES: luci-app-ddnsto
NO_REFRESH_CHECK: true
- name: Upload APK artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-apk-${{ matrix.ddnsto_type }}
path: |
bin/packages/${{ matrix.arch }}/packages_ci/*.apk
- name: Create APK release files
continue-on-error: true
run: |
mkdir -p release/apk
tar -zcvf release/apk/${{ matrix.arch }}-${{ matrix.ddnsto_type }}.tar.gz -C bin/packages/${{ matrix.arch }}/ packages_ci
- name: Upload APK to release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
name: DDNSTO ${{ env.build_time }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
allowUpdates: true
replacesArtifacts: false
prerelease: false
artifacts: "release/apk/${{ matrix.arch }}-${{ matrix.ddnsto_type }}.tar.gz"
# 构建 IPK (24.10)
build-ipk:
name: Build IPK ${{ matrix.arch }} (${{ matrix.ddnsto_type }})
runs-on: ubuntu-latest
needs: setup
if: github.event.inputs.build_type == 'ipk_only' || github.event.inputs.build_type == 'all' || github.event_name == 'push'
strategy:
fail-fast: false
matrix:
arch: ${{ fromJson(needs.setup.outputs.archs) }}
ddnsto_type: ${{ fromJson(needs.setup.outputs.ddnsto_types) }}
sdk:
- openwrt-24.10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup variables
run: |
sudo timedatectl set-timezone 'Asia/Shanghai'
git config --global user.name 'actions'
git config --global user.email 'action@github.com'
echo build_time="$(date '+%Y-%m-%d')" >> "$GITHUB_ENV"
- name: Set DDNSTO_TYPE in Makefile
run: |
sed -i "s/DDNSTO_TYPE?=standard/DDNSTO_TYPE=${{ matrix.ddnsto_type }}/" ddnsto/Makefile
grep "DDNSTO_TYPE" ddnsto/Makefile | head -1
- name: Build Packages (IPK)
uses: sbwml/openwrt-gh-action-sdk@go1.25
env:
ARCH: ${{ matrix.arch }}-${{ matrix.sdk }}
FEEDNAME: packages_ci
PACKAGES: luci-app-ddnsto
NO_REFRESH_CHECK: true
- name: Upload IPK artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-ipk-${{ matrix.ddnsto_type }}
path: |
bin/packages/${{ matrix.arch }}/packages_ci/*.ipk
- name: Create IPK release files
continue-on-error: true
run: |
mkdir -p release/ipk
tar -zcvf release/ipk/${{ matrix.arch }}-${{ matrix.ddnsto_type }}.tar.gz -C bin/packages/${{ matrix.arch }}/ packages_ci
- name: Upload IPK to release
if: startsWith(github.ref, 'refs/tags/')
uses: ncipollo/release-action@v1
with:
name: DDNSTO ${{ env.build_time }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
allowUpdates: true
replacesArtifacts: false
prerelease: false
artifacts: "release/ipk/${{ matrix.arch }}-${{ matrix.ddnsto_type }}.tar.gz"
release-notes:
needs: [build-apk, build-ipk]
runs-on: ubuntu-latest
# 只要有任意一个构建任务成功运行,就触发 release-notes
# 并且只在 push tag 时触发
if: |
always() &&
startsWith(github.ref, 'refs/tags/') &&
(needs.build-apk.result == 'success' || needs.build-apk.result == 'skipped') &&
(needs.build-ipk.result == 'success' || needs.build-ipk.result == 'skipped') &&
(needs.build-apk.result == 'success' || needs.build-ipk.result == 'success')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Release Notes
uses: ncipollo/release-action@v1
with:
name: DDNSTO ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
allowUpdates: true
body: |
## DDNSTO OpenWrt Package ${{ github.ref_name }}
### 支持的 OpenWrt 版本
- OpenWrt 24.10 / 22.03 (ipk 包格式)
- OpenWrt SNAPSHOT (apk 包格式)
### 支持的架构
- aarch64_generic
- arm_cortex-a9
- x86_64
- mipsel_24kc
### 安装说明
**OpenWrt 24.10 / 22.03 (opkg/ipk):**
```bash
opkg install ddnsto luci-app-ddnsto
```
**OpenWrt SNAPSHOT (apk):**
```bash
apk add ddnsto luci-app-ddnsto
```
### 功能特性
- 多设备索引支持
- WebDAV 文件共享
- 网络连通性检测
- 现代化 React 管理界面