Skip to content

Commit

Permalink
only release when new articles added
Browse files Browse the repository at this point in the history
  • Loading branch information
ofou committed Jul 27, 2024
1 parent 4288080 commit 6b7c3d0
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Pre Release"
name: "Pre Release on File Change"

on:
push:
Expand All @@ -10,16 +10,31 @@ on:
workflow_dispatch:

jobs:
build:
check_and_build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Run
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
- uses: marvinpinto/action-automatic-releases@latest
- 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"
Expand All @@ -28,4 +43,4 @@ jobs:
files: |
*.epub
*.pdf
*.csv
*.csv

0 comments on commit 6b7c3d0

Please sign in to comment.