mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2025-12-26 04:48:05 +08:00
46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: 手动构建并发布 Docker 镜像
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
publish-docker:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: 拉取源码
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: 获取最新的发布标签
|
|
id: get-latest-release
|
|
run: |
|
|
LATEST_TAG=$(curl -s \
|
|
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
|
https://api.github.com/repos/${{ github.repository }}/releases/latest \
|
|
| jq -r '.tag_name')
|
|
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
|
|
|
|
- name: 设置 QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: 设置 Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: 登录到 DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: 构建和推送 Docker 镜像到 Docker Hub
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: |
|
|
${{ secrets.DOCKERHUB_USERNAME }}/xhs-downloader:${{ env.LATEST_TAG }}
|
|
${{ secrets.DOCKERHUB_USERNAME }}/xhs-downloader:latest
|