mirror of
https://github.com/NewFuture/DDNS.git
synced 2026-10-19 16:15:45 +00:00
@@ -46,7 +46,7 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install build
|
||||
- run: sed -i -e "s#\${BUILD_SOURCEBRANCHNAME}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- name: Build package
|
||||
run: python -m build --sdist --wheel --outdir dist/
|
||||
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
with:
|
||||
name: pypi
|
||||
path: dist/
|
||||
retention-days: 7
|
||||
retention-days: 5
|
||||
|
||||
pyinstaller:
|
||||
strategy:
|
||||
@@ -75,10 +75,10 @@ jobs:
|
||||
|
||||
# Prepare build version and cert
|
||||
- name: Replace build version
|
||||
run: sed -i${{ fromJSON('["",".temp"]')[matrix.os == 'macos'] }} -e "s#\${BUILD_SOURCEBRANCHNAME}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
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
|
||||
- name: Copy cert on ubuntu
|
||||
if: ${{ matrix.os == 'ubuntu' }}
|
||||
if: runner.os == 'Linux'
|
||||
run: cp /etc/ssl/certs/ca-certificates.crt cert.pem && export SSL_CERT_FILE=${PWD}/cert.pem
|
||||
|
||||
- run: python ./run.py -h
|
||||
@@ -94,14 +94,14 @@ jobs:
|
||||
with:
|
||||
name: ${{ matrix.os }}-py${{ matrix.python-version }}
|
||||
path: dist/
|
||||
retention-days: 14
|
||||
retention-days: 7
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sed -i -e "s#\${BUILD_SOURCEBRANCHNAME}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
@@ -143,7 +143,7 @@ jobs:
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sed -i -e "s#\${BUILD_SOURCEBRANCHNAME}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- uses: docker/setup-qemu-action@v2
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
- uses: docker/login-action@v2
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sed -i -e "s#\${BUILD_SOURCEBRANCHNAME}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- uses: docker/setup-qemu-action@v2
|
||||
- uses: docker/setup-buildx-action@v2
|
||||
- uses: docker/login-action@v2
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
url: https://pypi.org/project/ddns/
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sed -i -e "s#\${BUILD_SOURCEBRANCHNAME}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
@@ -66,3 +66,55 @@ jobs:
|
||||
with:
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
print_hash: true
|
||||
|
||||
publish-binary:
|
||||
strategy:
|
||||
# fail-fast: false
|
||||
matrix:
|
||||
os: [windows, macos, ubuntu]
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
timeout-minutes: 8
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
- name: Install dependencies
|
||||
run: pip install pyinstaller
|
||||
|
||||
- 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
|
||||
- name: Copy cert on ubuntu
|
||||
if: ${{ matrix.os == 'ubuntu' }}
|
||||
run: cp /etc/ssl/certs/ca-certificates.crt cert.pem && export SSL_CERT_FILE=${PWD}/cert.pem
|
||||
|
||||
- run: pyinstaller --noconfirm --clean ./.build/ddns.spec
|
||||
- run: ./dist/ddns || test -e config.json
|
||||
- run: ./dist/ddns -h
|
||||
|
||||
- uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
draft: true
|
||||
generate_release_notes: false
|
||||
files: dist/
|
||||
|
||||
github-release:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
environment:
|
||||
name: publish
|
||||
url: https://github.com/NewFuture/DDNS/releases
|
||||
permissions:
|
||||
contents: write
|
||||
needs: [publish-docker, publish-pypi, publish-binary]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" .release/README.md
|
||||
- uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
draft: false
|
||||
generate_release_notes: true
|
||||
files: |
|
||||
.release/*.sh
|
||||
.release/*.bat
|
||||
|
||||
+10
-10
@@ -1,32 +1,32 @@
|
||||
[](https://pypi.org/project/ddns/${BUILD_SOURCEBRANCHNAME}/) 
|
||||
[](https://pypi.org/project/ddns/${BUILD_VERSION}/) 
|
||||
|
||||
## 使用二进制文件 
|
||||
|
||||
* Windows 下载 [ddns.exe](https://github.com/NewFuture/DDNS/releases/download/${BUILD_SOURCEBRANCHNAME}/ddns.exe)
|
||||
* Ubuntu 下载 [ddns](https://github.com/NewFuture/DDNS/releases/download/${BUILD_SOURCEBRANCHNAME}/ddns)
|
||||
* Mac OS X下载 [ddns-osx](https://github.com/NewFuture/DDNS/releases/download/${BUILD_SOURCEBRANCHNAME}/ddns-osx)
|
||||
* 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_SOURCEBRANCHNAME}/ddns.exe) 运行
|
||||
2. [可选] 定时任务 下载 [`create-task.bat`](https://github.com/NewFuture/DDNS/releases/download/${BUILD_SOURCEBRANCHNAME}/create-task.bat) 于**相同目录**,以管理员权限运行
|
||||
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_SOURCEBRANCHNAME}/ddns -#SLo ddns && chmod +x 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_SOURCEBRANCHNAME}/create-task.sh | bash
|
||||
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_SOURCEBRANCHNAME}/ddns-osx -#SLo ddns && chmod +x ddns
|
||||
curl https://github.com/NewFuture/DDNS/releases/download/${BUILD_VERSION}/ddns-osx -#SLo ddns && chmod +x ddns
|
||||
```
|
||||
|
||||
## 使用PIP 安装  
|
||||
|
||||
Pypi 安装当前版本或者更新最新版本
|
||||
|
||||
* 安装当前版本[current version]: `pip install ddns=${BUILD_SOURCEBRANCHNAME}`
|
||||
* 安装当前版本[current version]: `pip install ddns=${BUILD_VERSION}`
|
||||
* 更新最新版[update latest version]: `pip install -U ddns`
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.7"
|
||||
|
||||
os:
|
||||
- linux
|
||||
# - osx
|
||||
|
||||
before_install:
|
||||
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then export PYINSTALLER='pyinstaller==3.6';else export PYINSTALLER=pyinstaller;fi
|
||||
|
||||
# command to install dependencies
|
||||
install:
|
||||
- pip install ${PYINSTALLER}
|
||||
|
||||
# command to run tests
|
||||
script:
|
||||
- sed -i -e "s/\${BUILD_SOURCEBRANCHNAME}/${TRAVIS_BRANCH}/" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
|
||||
- cp /etc/ssl/certs/ca-certificates.crt cert.pem
|
||||
- export SSL_CERT_FILE=${PWD}/cert.pem
|
||||
- pyinstaller --onefile --noconfirm --clean ./.build/ddns.spec
|
||||
- ./dist/ddns || test -e "config.json"
|
||||
- ./dist/ddns -h
|
||||
|
||||
|
||||
git:
|
||||
depth: 2
|
||||
|
||||
deploy:
|
||||
- provider: releases
|
||||
token: "${GH_TOKEN}"
|
||||
skip_cleanup: true
|
||||
cleanup: false
|
||||
file:
|
||||
- "dist/ddns"
|
||||
on:
|
||||
tags: true
|
||||
branch: master
|
||||
python: '3.7'
|
||||
- provider: pypi
|
||||
username: newfuture-bot
|
||||
password: "${PYPI_PWD}"
|
||||
skip_cleanup: true
|
||||
cleanup: false
|
||||
distributions: "sdist bdist_wheel" # Your distributions here
|
||||
on:
|
||||
tags: true
|
||||
branch: master
|
||||
python: '3.7'
|
||||
@@ -4,7 +4,7 @@
|
||||
> 代理模式,支持自动创建域名记录。
|
||||
|
||||
[](https://pypi.org/project/ddns/)
|
||||
[](https://github.com/NewFuture/DDNS/actions/workflows/build.yml)
|
||||
[](https://github.com/NewFuture/DDNS/actions/workflows/build.yml)
|
||||
[](https://github.com/NewFuture/DDNS/releases/latest)
|
||||
|
||||
---
|
||||
|
||||
@@ -18,7 +18,7 @@ from util import ip
|
||||
from util.cache import Cache
|
||||
from util.config import init_config, get_config
|
||||
|
||||
__version__ = "${BUILD_SOURCEBRANCHNAME}@${BUILD_DATE}" # CI 时会被Tag替换
|
||||
__version__ = "${BUILD_VERSION}@${BUILD_DATE}" # CI 时会被Tag替换
|
||||
__description__ = "automatically update DNS records to dynamic local IP [自动更新DNS记录指向本地IP]"
|
||||
__doc__ = """
|
||||
ddns[%s]
|
||||
@@ -27,7 +27,7 @@ ddns[%s]
|
||||
Copyright (c) New Future (MIT License)
|
||||
""" % (__version__)
|
||||
|
||||
environ["DDNS_VERSION"] = "${BUILD_SOURCEBRANCHNAME}"
|
||||
environ["DDNS_VERSION"] = "${BUILD_VERSION}"
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
# https://github.com/pyinstaller/pyinstaller/wiki/Recipe-OpenSSL-Certificate
|
||||
|
||||
@@ -39,6 +39,8 @@ elif 'GITHUB_REF_NAME' in environ: # github actions
|
||||
ref = environ['GITHUB_REF_NAME']
|
||||
if ref == 'master' or ref == 'main': # CI
|
||||
version = '0.0.b' + str(int(time()))
|
||||
elif ref.startswith('v') or ref.startswith('V'): # Tag
|
||||
version = ref
|
||||
else: # PR
|
||||
version = '0.0.a1'
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user