Browse Source

update realease actions

New Future 6 months ago
parent
commit
7491693174
6 changed files with 197 additions and 74 deletions
  1. 76 0
      .github/release.md
  2. 5 5
      .github/workflows/build.yml
  3. 115 36
      .github/workflows/publish.yml
  4. 0 32
      .release/README.md
  5. 1 1
      README.md
  6. 0 0
      doc/img/ddns.svg

+ 76 - 0
.github/release.md

@@ -0,0 +1,76 @@
+[![PyPI version](https://img.shields.io/badge/DDNS-${BUILD_VERSION}-1abc9c.svg?style=social)](https://pypi.org/project/ddns/${BUILD_VERSION}/) ![Deploy OK](https://img.shields.io/badge/release-success-brightgreen.svg?style=flat-square)
+
+## 版本下载方式一览表
+
+| 平台/方式   |架构支持  |
+| ----------- |---------------------- |
+| Docker      | `newfuture/ddns:${BUILD_VERSION}`8种架构|
+| Windows     | [64位(x64)](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-windows-x64.exe) / [32位(x86)](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-windows-x32.exe) / [arm64](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-windows-arm64.exe) |
+| Linux |  [64位(x64)](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-linux-x64) / [arm64](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-linux-arm64) |
+| Mac OS X    |  [Apple Silicon (ARM64)](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-mac-arm64.app) / [Intel x64](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-mac-x64.app) |
+| Python/PIP  | any |
+
+## Docker (推荐)
+
+```bash
+# 当前版本
+docker --name ddns -v $(pwd)/:/DDNS newfuture/ddns:${BUILD_VERSION} -h
+# 最新版本(可能有缓存)
+docker --name ddns -v $(pwd)/:/DDNS newfuture/ddns -h
+```
+
+请将 `$(pwd)/` 替换为你的配置文件夹。
+  * 命令行参数使用 `-h`
+  * 配置文件config.json,使用vscode等编辑会有自动提示
+  * 环境变量`DDNS_XXX`
+
+支持源:
+* Docker官方源: [docker.io/newfuture/ddns](https://hub.docker.com/r/newfuture/ddns)
+* Github镜像源: [ghcr.io/newfuture/ddns](https://github.com/NewFuture/DDNS/pkgs/container/ddns/426721813?tag=${BUILD_VERSION})
+
+---
+
+## 使用二进制文件 ![cross platform](https://img.shields.io/badge/platform-windows_%7C%20linux_%7C%20osx-success.svg?style=flat-square)
+
+* Windows 下载 [ddns.exe](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns.exe)
+* Ubuntu 下载 [ddns](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns)
+* Mac OS X下载 [ddns-osx](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-osx)
+
+各平台下载/使用方式
+
+* ### Windows
+
+1. 下载 [`ddns-windows-x64.exe`](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-windows-x64.exe) 或者 [`ddns-windows-x32.exe`](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-windows-x32.exe) 或者[`ddns-windows-arm64.exe`](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-windows-arm64.exe) 保存为`ddns.exe` 运行
+2. [可选] 定时任务 下载 [`create-task.bat`](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/create-task.bat) 于**相同目录**,以管理员权限运行
+
+* ### Ubuntu
+
+```bash
+# 1. 下载ddns 
+# x64 版本
+curl https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-linux-x64 -#SLo ddns && chmod +x ddns
+
+# arm64 版本
+curl https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-linux-arm64 -#SLo ddns && chmod +x ddns
+
+# 2. [可选] 定时任务(当前目录): 
+curl -sSL https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/create-task.sh | bash
+```
+
+* ### Mac OSX
+
+```sh
+# 命令行下载
+# arm64
+curl https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-mac-arm64.app -#SLo ddns && chmod +x ddns
+
+# intel x64
+curl https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-mac-x64.app -#SLo ddns && chmod +x ddns
+```
+
+## 使用PIP 安装 ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ddns.svg?style=flat-square) ![PyPI - Wheel](https://img.shields.io/pypi/wheel/ddns.svg?style=flat-square)
+
+Pypi 安装当前版本或者更新最新版本
+
+* 安装当前版本[current version]: `pip install ddns=${BUILD_VERSION}`
+* 更新最新版[update latest version]: `pip install -U ddns`

+ 5 - 5
.github/workflows/build.yml

@@ -115,7 +115,6 @@ jobs:
   nuitka:
     needs: [ python ]
     strategy:
-      fail-fast: false
       matrix:
         include:
           - os: windows-latest
@@ -180,7 +179,7 @@ jobs:
             dns.he
             dns.huaweidns
             dns.callback
-          file-description: "DDNS Client 更新域名解析本机IP"
+          file-description: "DDNS Client 更新域名解析本机IP-预览版"
           product-name: DDNS
           company-name: "New Future"
           copyright: "https://ddns.newfuture.cc"
@@ -190,10 +189,10 @@ jobs:
           nofollow-import-to: tkinter,unittest,pydoc,doctest,distutils,setuptools,lib2to3,test,idlelib,lzma
           onefile-tempdir-spec: "{CACHE_DIR}/{PRODUCT}_{VERSION}"
           windows-icon-from-ico:  ${{ runner.os == 'Windows' && 'favicon.ico' || '' }}
-          linux-icon: ${{ runner.os == 'Linux' && '.build/ddns.svg' || '' }}
+          linux-icon: ${{ runner.os == 'Linux' && 'doc/img/ddns.svg' || '' }}
           static-libpython: ${{ runner.os == 'Linux' && 'yes' || 'auto' }}
           macos-app-name: ${{ runner.os == 'macOS' && 'DDNS' || '' }}
-          macos-app-icon: ${{ runner.os == 'macOS' && '.build/ddns.svg' || '' }}
+          macos-app-icon: ${{ runner.os == 'macOS' && 'doc/img/ddns.svg' || '' }}
 
 
       - run: ./dist/ddns || test -e config.json
@@ -212,12 +211,13 @@ jobs:
             dist/ddns
 
   nuitka-linux:
+    needs: [ python ]
     strategy:
       fail-fast: false
       matrix:
         os: [ ubuntu-latest, ubuntu-24.04-arm ]
     runs-on:  ${{ matrix.os }}
-    timeout-minutes: 30
+    timeout-minutes: 10
     steps:
       - uses: actions/checkout@v4
 

+ 115 - 36
.github/workflows/publish.yml

@@ -17,7 +17,6 @@ jobs:
     permissions:
       packages: write
     env:
-      DOCKER_BUILD_RECORD_UPLOAD: false
       platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
     steps:
       - uses: actions/checkout@v4
@@ -41,6 +40,8 @@ jobs:
           images: |
             ghcr.io/newfuture/ddns
             newfuture/ddns
+        env:
+          DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
       - uses: docker/build-push-action@v6
         with:
           context: .
@@ -49,10 +50,7 @@ jobs:
           push: true
           tags: ${{ steps.meta.outputs.tags }}
           labels: ${{ steps.meta.outputs.labels }}
-          outputs: type=image,name=target,\
-           annotation-index.org.opencontainers.image.description=DDNS alpine container,\
-           annotation-index.org.opencontainers.image.source=https://github.com/NewFuture/DDNS,\
-           annotation-index.org.opencontainers.image.licenses=MIT
+          annotations: ${{ steps.meta.outputs.annotations }}
       
 
   publish-pypi:
@@ -80,20 +78,35 @@ jobs:
         with:
           print-hash: true
 
-  build-binary:
+  publish-binary:
     strategy:
-      # fail-fast: false
+      fail-fast: false
       matrix:
-        os: [windows-latest, windows-11-arm, ubuntu-latest, ubuntu-24.04-arm, macos-13, macos-latest]
+        include:
+          - os: windows-latest
+            arch: x64
+          - os: windows-latest
+            arch: x86
+          - os: windows-11-arm
+            arch: arm64
+          - os: ubuntu-latest
+            arch: x64
+          - os: ubuntu-24.04-arm
+            arch: arm64
+          - os: macos-13
+            arch: x64
+          - os: macos-latest
+            arch: arm64
     runs-on: ${{ matrix.os }}
     timeout-minutes: 10
+    permissions:
+      contents: write
     steps:
       - uses: actions/checkout@v4
       - uses: actions/setup-python@v5
         with:
           python-version: "3.x"
-      - name: Install dependencies
-        run: pip install nuitka
+          architecture: ${{ matrix.arch }}
 
       - name: Replace build version
         run: sed -i.tmp -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py && rm run.py.tmp
@@ -102,34 +115,103 @@ jobs:
       - name: remove python2 code
         run:  python3 .build/remove_python2.py
 
-      - name: setup on Linux
+      - name: Set up on Linux
         if: runner.os == 'Linux'
         run: |
-          apt-get update && apt install -y patchelf ccache
-          echo " --static-libpython=yes --linux-icon=.build/ddns.svg" >> .build/nuitka.cmd
+          sudo apt-get update &&  sudo apt-get install -y patchelf
           cp /etc/ssl/certs/ca-certificates.crt cert.pem && export SSL_CERT_FILE=${PWD}/cert.pem
-      
-      - name: setup on macOS
+      - name: Set up on macOS
         if: runner.os == 'macOS'
-        run: |
-          python3 -m pip install imageio
-          echo " --macos-app-name=DDNS --macos-app-icon=.build/ddns.svg" >> .build/nuitka.cmd
+        run: python3 -m pip install imageio
 
-      - name: Package binary
-        run: ./.build/nuitka.cmd
+      - name: test run.py
+        run: python3 ./run.py -h
+
+      - name: Build Executable
+        uses: Nuitka/[email protected]
+        with:
+          nuitka-version: main
+          script-name: run.py
+          mode: onefile
+          output-dir: dist
+          output-file: ddns
+          no-deployment-flag: self-execution
+          include-module: |
+            dns.dnspod
+            dns.alidns
+            dns.dnspod_com
+            dns.dnscom
+            dns.cloudflare
+            dns.he
+            dns.huaweidns
+            dns.callback
+          file-description: "DDNS Client 更新域名解析本机IP"
+          product-name: DDNS
+          company-name: "New Future"
+          copyright: "https://ddns.newfuture.cc"
+          assume-yes-for-downloads: true
+          lto: auto
+          python-flag: no_site,no_asserts,no_docstrings,isolated,static_hashes
+          nofollow-import-to: tkinter,unittest,pydoc,doctest,distutils,setuptools,lib2to3,test,idlelib,lzma
+          onefile-tempdir-spec: "{CACHE_DIR}/{PRODUCT}_{VERSION}"
+          windows-icon-from-ico:  ${{ runner.os == 'Windows' && 'favicon.ico' || '' }}
+          linux-icon: ${{ runner.os == 'Linux' && 'doc/img/ddns.svg' || '' }}
+          static-libpython: ${{ runner.os == 'Linux' && 'yes' || 'auto' }}
+          macos-app-name: ${{ runner.os == 'macOS' && 'DDNS' || '' }}
+          macos-app-icon: ${{ runner.os == 'macOS' && 'doc/img/ddns.svg' || '' }}
 
       - run: ./dist/ddns || test -e config.json
       - run: ./dist/ddns -h
 
-      - name: Move and rename binary with lowercase OS and arch
-        run: mv ./dist/ddns "./dist/ddns-$(echo ${{ runner.os }}-${{ runner.arch }} | tr '[:upper:]' '[:lower:]')"
-        shell: bash
+      - run: mv ./dist/ddns ./dist/ddns-ubuntu24.04-${{ runner.arch }}
+        if: runner.os == 'Linux'
+      - run: mv ./dist/ddns ./dist/ddns-mac-${{ runner.arch }}.app
+        if: runner.os == 'macOS'
+      - run: mv ./dist/ddns.exe ./dist/ddns-windows-${{ runner.arch }}.exe
+        if: runner.os == 'Windows'
+      - name: Upload files
+        run: gh release upload ${{ github.ref_name }} dist/ddns* --clobber
+        env:
+          GH_TOKEN: ${{ github.token }}
 
-      - uses: actions/upload-artifact@v4
+  publish-linux-general:
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [ ubuntu-latest, ubuntu-24.04-arm ]
+    runs-on:  ${{ matrix.os }}
+    timeout-minutes: 10
+    permissions:
+      contents: write
+    steps:
+      - uses: actions/checkout@v4
+
+      # Prepare build
+      - name: Replace build version
+        run: sed -i.tmp -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py && rm run.py.tmp
+        shell: bash
+        
+        # https://github.com/Nuitka/Nuitka/issues/2723#issuecomment-1960831891 
+      - name: Run the build process with CentOS Docker
+        uses: addnab/docker-run-action@v3
         with:
-          name: ${{ runner.os }}
-          path: dist/
-          retention-days: 10
+            image: docker.io/centos:8
+            options: -v ${{ github.workspace }}:/DDNS
+            run: |
+                cd /etc/yum.repos.d/ && sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
+                dnf install -y epel-release \
+                && dnf repolist \
+                && dnf install -y gcc strace patchelf ccache gdb make python3-devel python3-zstandard python3-ordered-set
+                python3 -m pip install nuitka
+                cd /DDNS &&  python3 .build/remove_python2.py && .build/nuitka.cmd
+
+      - run: ./dist/ddns || test -e config.json
+      - run: ./dist/ddns -h 
+      - run: mv ./dist/ddns ./dist/ddns-linux-${{ runner.arch }}
+      - name: Upload files
+        run: gh release upload ${{ github.ref_name }} dist/ddns* --clobber
+        env:
+          GH_TOKEN: ${{ github.token }}
 
   github-release:
     runs-on: ubuntu-latest
@@ -139,16 +221,13 @@ jobs:
       url: https://github.com/NewFuture/DDNS/releases/tag/${{ github.ref_name }}
     permissions:
       contents: write
-    needs: [publish-docker, publish-pypi, build-binary]
+    needs: [publish-docker, publish-pypi, publish-binary, publish-linux-general]
     steps:
       - uses: actions/checkout@v4
-      - run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" .release/README.md
-      - uses: actions/download-artifact@v4
-        with:
-          path: dist
+      - run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" .github/release.md
 
       - name: Upload files
-        run: gh release upload ${{ github.ref_name }} .release/*.sh .release/*.bat dist/*/* --clobber
+        run: gh release upload ${{ github.ref_name }} .release/*.sh .release/*.bat --clobber
         env:
           GH_TOKEN: ${{ github.token }}
           
@@ -156,6 +235,6 @@ jobs:
         env:
           GH_TOKEN: ${{ github.token }}
         run: |
-          gh release view ${{ github.ref_name }} --json body -q '.body' > .release/notes.md
-          cat .release/README.md >> .release/notes.md
-          gh release edit ${{ github.ref_name }} --notes-file .release/notes.md --latest --prerelease=false
+          gh release view ${{ github.ref_name }} --json body -q '.body' > release_notes.md
+          cat .github/release.md >> release_notes.md
+          gh release edit ${{ github.ref_name }} --notes-file release_notes.md

+ 0 - 32
.release/README.md

@@ -1,32 +0,0 @@
-[![PyPI version](https://img.shields.io/badge/DDNS-${BUILD_VERSION}-1abc9c.svg?style=social)](https://pypi.org/project/ddns/${BUILD_VERSION}/) ![Deploy OK](https://img.shields.io/badge/release-success-brightgreen.svg?style=flat-square)
-
-## 使用二进制文件 ![cross platform](https://img.shields.io/badge/platform-windows_%7C%20linux_%7C%20osx-success.svg?style=flat-square)
-
-* Windows 下载 [ddns.exe](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns.exe)
-* Ubuntu 下载 [ddns](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns)
-* Mac OS X下载 [ddns-osx](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-osx)
-
-各平台下载/使用方式
-
-* ### Windows
-    1. 下载 [`ddns.exe`](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns.exe) 运行
-    2. [可选] 定时任务 下载 [`create-task.bat`](https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/create-task.bat) 于**相同目录**,以管理员权限运行
-* ### Ubuntu
-```bash
-# 1. 下载ddns 
-curl https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns -#SLo ddns && chmod +x ddns
-# 2. [可选] 定时任务(当前目录): 
-curl -sSL https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/create-task.sh | bash
-```
-* ### Mac OSX
-```sh
-# 命令行下载
-curl https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-osx -#SLo ddns && chmod +x ddns
-```
-
-## 使用PIP 安装 ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ddns.svg?style=flat-square) ![PyPI - Wheel](https://img.shields.io/pypi/wheel/ddns.svg?style=flat-square)
-
-Pypi 安装当前版本或者更新最新版本
-
-* 安装当前版本[current version]: `pip install ddns=${BUILD_VERSION}`
-* 更新最新版[update latest version]: `pip install -U ddns`

+ 1 - 1
README.md

@@ -1,4 +1,4 @@
-# [DDNS](https://github.com/NewFuture/DDNS) [<img src=".build/ddns.svg" width="32px" height="32px"/>](https://ddns.newfuture.cc)
+# [<img src="doc/img/ddns.svg" width="32px" height="32px"/>](https://ddns.newfuture.cc) [DDNS](https://github.com/NewFuture/DDNS) 
 
 > 自动更新 DNS 解析 到本机 IP 地址,支持 ipv4 和 ipv6 以 本地(内网)IP 和 公网 IP。
 > 代理模式,支持自动创建域名记录。

+ 0 - 0
.build/ddns.svg → doc/img/ddns.svg