重写 AutoFilm/app/modules/alist2strm.py #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AutoFilm Builder | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
APP_VERSION: | |
description: '版本号,用于 Docker 标签' | |
required: false | |
IS_USE_LATEST_TAG: | |
description: '是否使用latest标签' | |
default: true | |
type: boolean | |
IS_USE_VERSION_TAG: | |
description: '是否使用版本标签' | |
default: true | |
type: boolean | |
env: | |
IS_USE_LATEST_TAG: false | |
IS_USE_VERSION_TAG: false | |
jobs: | |
Docker-build: | |
runs-on: ubuntu-latest | |
name: Build Docker Image | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup | |
run: | | |
echo "APP_VERSION=$(cat app/version.py | sed -ne 's/APP_VERSION\s=\s"v\(.*\)"/\1/gp')" >> $GITHUB_ENV | |
echo "DEV_TAG=Dev-$(date +"%Y%m%d")" >> $GITHUB_ENV | |
- name: Check Version Change | |
run: | | |
if git diff --name-only ${{ github.sha }} | grep 'app/version.py'; then | |
echo "IS_USE_LATEST_TAG=true" >> $GITHUB_ENV | |
echo "IS_USE_VERSION_TAG=true" >> $GITHUB_ENV | |
fi | |
- name: Use Latest Tag | |
if: ${{ github.event.inputs.IS_USE_LATEST_TAG }} | |
run: | | |
echo "使用latest标签" | |
echo "IS_USE_LATEST_TAG=true" >> $GITHUB_ENV | |
- name: Use Version Tag | |
if: ${{ github.event.inputs.IS_USE_VERSION_TAG }} | |
run: | | |
echo "使用版本标签" | |
echo "IS_USE_VERSION_TAG=true" >> $GITHUB_ENV | |
- name: Docker Meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.DOCKERHUB_USERNAME }}/autofilm | |
tags: | | |
type=raw,value=latest,enable=${{ env.IS_USE_LATEST_TAG }} | |
type=raw,value=${{ env.APP_VERSION }},enable=${{ env.IS_USE_VERSION_TAG }} | |
type=raw,value=${{ env.DEV_TAG }},enable=true | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: | | |
linux/amd64 | |
linux/arm64/v8 | |
push: true | |
build-args: | | |
AUTOFILM_VERSION=${{ env.APP_VERSION }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha, scope=${{ github.workflow }}-docker | |
cache-to: type=gha, scope=${{ github.workflow }}-docker | |
- name: Details Infomations | |
run: | | |
echo "现在输出详细信息" | |
echo "=====================================" | |
echo "VERSION: ${{ env.APP_VERSION }}" | |
echo "Image: ${{ steps.meta.outputs.images }}" | |
echo "Tags: ${{ steps.meta.outputs.tags }}" | |
echo "Labels: ${{ steps.meta.outputs.labels }}" | |
echo "Digest: ${{ steps.meta.outputs.digests }}" | |
echo "Platform: ${{ steps.meta.outputs.platforms}}" |