-
Notifications
You must be signed in to change notification settings - Fork 666
129 lines (120 loc) · 3.86 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Publish
on:
push:
tags: [v*]
permissions:
contents: read
jobs:
publish-docker:
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: publish
url: https://hub.docker.com/r/newfuture/ddns
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- 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
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: |
ghcr.io/newfuture/ddns
newfuture/ddns
- uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
publish-pypi:
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: publish
url: https://pypi.org/project/ddns/
steps:
- uses: actions/checkout@v3
- 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"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build --sdist --wheel --outdir dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
print_hash: true
build-binary:
strategy:
matrix:
os: [macos, ubuntu, windows]
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: runner.os == 'Linux'
run: cp /etc/ssl/certs/ca-certificates.crt cert.pem && export SSL_CERT_FILE=${PWD}/cert.pem
- run: python -O -m PyInstaller --noconfirm --clean .build/ddns.spec
- run: ./dist/ddns || test -e config.json
- run: ./dist/ddns -h
- run: mv ./dist/ddns ./dist/ddns-osx
if: runner.os == 'macOS'
- uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}
path: dist/
retention-days: 10
github-release:
runs-on: ubuntu-latest
timeout-minutes: 5
environment:
name: publish
url: https://github.com/NewFuture/DDNS/releases/tag/${{ github.ref_name }}
permissions:
contents: write
needs: [publish-docker, publish-pypi, build-binary]
steps:
- uses: actions/checkout@v3
- run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" .release/README.md
- uses: actions/download-artifact@v4.1.7
with:
path: dist
- uses: softprops/action-gh-release@master
with:
draft: false
prerelease: false
generate_release_notes: true
body_path: .release/README.md
fail_on_unmatched_files: true
append_body: true
files: |
.release/*.sh
.release/*.bat
dist/*/*