Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Update ci.yml

Update ci.yml #16

Workflow file for this run

name: ci
on:
push:
branches:
- 'main'
schedule:
- cron: '0 0 * * *' # 每天UTC时间的0:00执行一次,检测新版本
jobs:
check-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get latest Flexget release
id: get_release
run: |
latest_release=$(curl -s https://api.github.com/repos/Flexget/Flexget/releases/latest | jq -r '.tag_name')
echo "TAG_NAME=$latest_release" >> $GITHUB_ENV
- name: Compare with stored release
id: compare_release
run: |
pwd
ls -la
cat stored_release.txt
stored_release=$(cat stored_release.txt 2>/dev/null || echo "")
latest_release=$TAG_NAME
if [ "$stored_release" != "$latest_release" ]; then
echo "New release detected: $latest_release"
echo "$latest_release" > stored_release.txt
else
echo "No new release found. Exiting."
exit 0 # 如果没有新版本,退出工作流程
fi
- name: Build and push Docker image
if: steps.compare_release.outputs.tag_name != ''
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/flexget:latest