Skip to content

Commit ce997a3

Browse files
committed
ci: 优化 Docker 镜像发布流程并支持 GHCR
- 修改 Docker 镜像发布流程,同时支持 Docker Hub 和 GitHub Container Registry (GHCR) - 更新手动发布和自动发布工作流,增加版本号和标签处理逻辑 - 调整过时问题和 PR 自动管理策略,缩短处理周期 - 在 README 中添加通过 GHCR 拉取镜像的方式 Closes #474
1 parent 3283a65 commit ce997a3

6 files changed

Lines changed: 95 additions & 22 deletions

File tree

.github/workflows/Close_Stale_Issues_and_PRs.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "自动管理过时的问题和PR"
22
on:
33
schedule:
4-
- cron: "0 18 * * *"
4+
- cron: "0 0 * * 5"
55

66
permissions:
77
issues: write
@@ -14,21 +14,21 @@ jobs:
1414
- uses: actions/stale@v9
1515
with:
1616
stale-issue-message: |
17-
⚠️ 此 Issue 已超过一定时间未活动,如果没有进一步更新,将在 30 天后关闭。
18-
⚠️ This issue has been inactive for a certain period of time. If there are no further updates, it will be closed in 30 days.
17+
⚠️ 此 Issue 已超过一定时间未活动,如果没有进一步更新,将在 14 天后关闭。
18+
⚠️ This issue has been inactive for a certain period of time. If there are no further updates, it will be closed in 14 days.
1919
close-issue-message: |
2020
🔒 由于长时间未响应,此 Issue 已被自动关闭。如有需要,请重新打开或提交新 issue。
2121
🔒 Due to prolonged inactivity, this issue has been automatically closed. If needed, please reopen it or submit a new issue.
2222
stale-pr-message: |
23-
⚠️ 此 PR 已超过一定时间未更新,请更新,否则将在 30 天后关闭。
24-
⚠️ This PR has not been updated for a certain period of time. Please update it, otherwise it will be closed in 30 days.
23+
⚠️ 此 PR 已超过一定时间未更新,请更新,否则将在 14 天后关闭。
24+
⚠️ This PR has not been updated for a certain period of time. Please update it, otherwise it will be closed in 14 days.
2525
close-pr-message: |
2626
🔒 此 PR 已因无更新而自动关闭。如仍需合并,请重新打开或提交新 PR。
2727
🔒 This PR has been automatically closed due to inactivity. If you still wish to merge it, please reopen it or submit a new PR.
2828
29-
days-before-issue-stale: 60
30-
days-before-pr-stale: 60
31-
days-before-close: 30
29+
days-before-issue-stale: 28
30+
days-before-pr-stale: 28
31+
days-before-close: 14
3232

3333
stale-issue-label: "未跟进问题(Stale)"
3434
close-issue-label: "自动关闭(Close)"

.github/workflows/Manually_docker_image.yml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@ name: 构建并发布 Docker 镜像
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
is_beta:
7+
type: boolean
8+
required: true
9+
description: "开发版"
10+
default: true
11+
custom_version:
12+
type: string
13+
required: false
14+
description: "版本号"
15+
default: ""
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
attestations: write
21+
id-token: write
22+
23+
env:
24+
REGISTRY: ghcr.io
25+
DOCKER_REPO: ${{ secrets.DOCKERHUB_USERNAME }}/tiktok-downloader
26+
GHCR_REPO: ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/tiktok-downloader
527

628
jobs:
729
publish-docker:
@@ -16,10 +38,17 @@ jobs:
1638
- name: 获取最新的发布标签
1739
id: get-latest-release
1840
run: |
19-
LATEST_TAG=$(curl -s \
20-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
21-
https://api.github.com/repos/${{ github.repository }}/releases/latest \
22-
| jq -r '.tag_name')
41+
if [ -z "${{ github.event.inputs.custom_version }}" ]; then
42+
LATEST_TAG=$(curl -s \
43+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
44+
https://api.github.com/repos/${{ github.repository }}/releases/latest \
45+
| jq -r '.tag_name')
46+
else
47+
LATEST_TAG=${{ github.event.inputs.custom_version }}
48+
fi
49+
if [ -z "$LATEST_TAG" ]; then
50+
exit 1
51+
fi
2352
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
2453
2554
- name: 设置 QEMU
@@ -28,18 +57,37 @@ jobs:
2857
- name: 设置 Docker Buildx
2958
uses: docker/setup-buildx-action@v3
3059

31-
- name: 登录到 DockerHub
60+
- name: 生成标签
61+
id: generate-tags
62+
run: |
63+
if [ "${{ inputs.is_beta }}" == "true" ]; then
64+
LATEST_TAG="${LATEST_TAG%.*}.$(( ${LATEST_TAG##*.} + 1 ))"
65+
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
66+
TAGS="${{ env.DOCKER_REPO }}:${LATEST_TAG}-dev,${{ env.GHCR_REPO }}:${LATEST_TAG}-dev"
67+
else
68+
TAGS="${{ env.DOCKER_REPO }}:${LATEST_TAG},${{ env.DOCKER_REPO }}:latest,${{ env.GHCR_REPO }}:${LATEST_TAG},${{ env.GHCR_REPO }}:latest"
69+
fi
70+
echo "TAGS=$TAGS" >> $GITHUB_ENV
71+
72+
- name: 登录到 Docker Hub
3273
uses: docker/login-action@v3
3374
with:
3475
username: ${{ secrets.DOCKERHUB_USERNAME }}
3576
password: ${{ secrets.DOCKERHUB_TOKEN }}
3677

37-
- name: 构建和推送 Docker hub
78+
- name: 登录到 GitHub Container Registry
79+
uses: docker/login-action@v3
80+
with:
81+
registry: ${{ env.REGISTRY }}
82+
username: ${{ github.actor }}
83+
password: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: 构建和推送 Docker 镜像到 Docker Hub 和 GHCR
3886
uses: docker/build-push-action@v6
3987
with:
4088
context: .
4189
platforms: linux/amd64,linux/arm64
4290
push: true
43-
tags: |
44-
${{ secrets.DOCKERHUB_USERNAME }}/tiktok-downloader:${{ env.LATEST_TAG }}
45-
${{ secrets.DOCKERHUB_USERNAME }}/tiktok-downloader:latest
91+
tags: ${{ env.TAGS }}
92+
provenance: false
93+
sbom: false

.github/workflows/Release_docker_image.yml

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
release:
55
types: [ published ]
66

7+
permissions:
8+
contents: read
9+
packages: write
10+
attestations: write
11+
id-token: write
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
DOCKER_REPO: ${{ secrets.DOCKERHUB_USERNAME }}/tiktok-downloader
16+
GHCR_REPO: ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/tiktok-downloader
17+
718
jobs:
819
publish-docker:
920
runs-on: ubuntu-latest
@@ -20,18 +31,29 @@ jobs:
2031
- name: 设置 Docker Buildx
2132
uses: docker/setup-buildx-action@v3
2233

23-
- name: 登录到 DockerHub
34+
- name: 登录到 Docker Hub
2435
uses: docker/login-action@v3
2536
with:
2637
username: ${{ secrets.DOCKERHUB_USERNAME }}
2738
password: ${{ secrets.DOCKERHUB_TOKEN }}
2839

29-
- name: 构建和推送 Docker hub
40+
- name: 登录到 GitHub Container Registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: ${{ env.REGISTRY }}
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: 构建和推送 Docker 镜像到 Docker Hub 和 GHCR
3048
uses: docker/build-push-action@v6
3149
with:
3250
context: .
3351
platforms: linux/amd64,linux/arm64
3452
push: true
3553
tags: |
36-
${{ secrets.DOCKERHUB_USERNAME }}/tiktok-downloader:${{ github.event.release.tag_name }}
37-
${{ secrets.DOCKERHUB_USERNAME }}/tiktok-downloader:latest
54+
${{ env.DOCKER_REPO }}:${{ github.event.release.tag_name }}
55+
${{ env.DOCKER_REPO }}:latest
56+
${{ env.GHCR_REPO }}:${{ github.event.release.tag_name }}
57+
${{ env.GHCR_REPO }}:latest
58+
provenance: false
59+
sbom: false

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ demo()
178178
<ul>
179179
<li>方式一:使用 <code>Dockerfile</code> 文件构建镜像</li>
180180
<li>方式二:使用 <code>docker pull joeanamier/tiktok-downloader</code> 命令拉取镜像</li>
181+
<li>方式三:使用 <code>docker pull ghcr.io/joeanamier/tiktok-downloader</code> 命令拉取镜像</li>
181182
</ul>
182183
<li>创建容器:<code>docker run --name 容器名称(可选) -p 主机端口号:5555 -v tiktok_downloader_volume:/TikTokDownloader -it joeanamier/tiktok-downloader</code></li>
183184
<li>运行容器

README_EN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ demo()
184184
<ul>
185185
<li>Method 1: Build the image using the <code>Dockerfile</code>.</li>
186186
<li>Method 2: Pull the image using the command <code>docker pull joeanamier/tiktok-downloader</code>.</li>
187+
<li>Method 3: Pull the image using the command <code>docker pull ghcr.io/joeanamier/tiktok-downloader</code>.</li>
187188
</ul>
188189
<li>Create the container: <code>docker run --name ContainerName(optional) -p HostPort:5555 -v tiktok_downloader_volume:/TikTokDownloader -it joeanamier/tiktok-downloader</code>.</li>
189190
<li>Run the container

docs/TikTokDownloader文档.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</div>
1717
<br>
1818
<p>🔥 <b>TikTok 发布/喜欢/合辑/直播/视频/图集/音乐;抖音发布/喜欢/收藏/收藏夹/视频/图集/实况/直播/音乐/合集/评论/账号/搜索/热榜数据采集工具:</b>完全开源,基于 HTTPX 模块实现的免费数据采集和文件下载工具;批量下载抖音账号发布、喜欢、收藏、收藏夹作品;批量下载 TikTok 账号发布、喜欢作品;下载抖音链接或 TikTok 链接作品;获取抖音直播推流地址;下载抖音直播视频;获取 TikTok 直播推流地址;下载 TikTok 直播视频;采集抖音作品评论数据;批量下载抖音合集作品;批量下载 TikTok 合辑作品;采集抖音账号详细数据;采集抖音用户 / 作品 / 直播搜索结果;采集抖音热榜数据。</p>
19-
<p>⭐ <b>文档对应项目版本:<code>5.6 Stable</code>;文档内容正在完善中,如有发现任何错误或描述模糊之处,请告知作者以便改进!</b></p>
19+
<p>⭐ <b>文档对应项目版本:<code>5.7 Beta</code>;文档内容正在完善中,如有发现任何错误或描述模糊之处,请告知作者以便改进!</b></p>
2020
<hr>
2121
<h1>快速入门</h1>
2222
<p>⭐ 本项目包含手动构建可执行文件的 GitHub Actions,使用者可以随时使用 GitHub Actions 将最新源码构建为可执行文件!</p>
@@ -62,6 +62,7 @@
6262
<ul>
6363
<li>方式一:使用 <code>Dockerfile</code> 文件构建镜像</li>
6464
<li>方式二:使用 <code>docker pull joeanamier/tiktok-downloader</code> 命令拉取镜像</li>
65+
<li>方式三:使用 <code>docker pull ghcr.io/joeanamier/tiktok-downloader</code> 命令拉取镜像</li>
6566
</ul>
6667
<li>创建容器:<code>docker run --name 容器名称(可选) -p 主机端口号:5555 -v tiktok_downloader_volume:/TikTokDownloader -it joeanamier/tiktok-downloader</code></li>
6768
<li>运行容器

0 commit comments

Comments
 (0)