Skip to content

Build and Push Custom FreshRSS Image #32

Build and Push Custom FreshRSS Image

Build and Push Custom FreshRSS Image #32

Workflow file for this run

name: Build and Push Custom FreshRSS Image
on:
workflow_dispatch: # 允许手动触发
push: # 监听推送事件
branches:
- main
paths:
- 'greader.php'
- 'FeedDAO.php'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout patch repository
uses: actions/checkout@v6
with:
path: patch # 检出您自己的补丁仓库
- name: Checkout FreshRSS official repository
uses: actions/checkout@v6
with:
repository: FreshRSS/FreshRSS
path: freshrss-source
ref: edge # 拉取最新的开发分支
- name: Get Short SHA and Timestamp
id: vars
# 核心修复:明确在 patch 目录下执行 git 命令,并处理变量输出
run: |
cd patch
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "timestamp=$(date +'%Y%m%d-%H%M')" >> $GITHUB_OUTPUT
- name: Apply patches
run: |
echo "Applying custom greader.php..."
# 确保目标目录存在(虽然 edge 分支通常已有该路径)
cp patch/greader.php freshrss-source/p/api/greader.php
echo "Applying custom FeedDAO.php..."
# 覆盖 1.21+ / 1.28.0 版本的核心 DAO 文件
cp patch/FeedDAO.php freshrss-source/app/Models/FeedDAO.php
echo "Patches applied successfully."
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: ./freshrss-source
file: ./freshrss-source/Docker/Dockerfile-Alpine
push: true
# 修复点:确保引用时变量不为空
tags: |
aloklok/freshrss-custom:latest
aloklok/freshrss-custom:${{ steps.vars.outputs.sha_short }}
aloklok/freshrss-custom:build-${{ steps.vars.outputs.timestamp }}