Skip to content

Pre Release on File Change #652

Pre Release on File Change

Pre Release on File Change #652

Workflow file for this run

name: "Pre Release on File Change"
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 0 * * *" # Run every day at midnight UTC
workflow_dispatch:
jobs:
check_and_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2 # To be able to get the changes
- name: Check for file changes
id: check_files
run: |
if git diff --name-only HEAD^ HEAD | grep -E '\.(epub|pdf|csv)$'; then
echo "changes_detected=true" >> $GITHUB_OUTPUT
else
echo "changes_detected=false" >> $GITHUB_OUTPUT
fi
- name: Run build if changes detected
if: steps.check_files.outputs.changes_detected == 'true'
run: |
make all
- name: Create release if changes detected
if: steps.check_files.outputs.changes_detected == 'true'
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Paul Graham Essays"
files: |
*.epub
*.pdf
*.csv