fix #10 - generate GIF only if src changed #31
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: Generate demo gif | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
generate-gif: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check for changes in src folder | |
id: check_changes | |
run: | | |
if git diff --quiet HEAD^ HEAD -- src/; then | |
echo "No changes in the src folder." | |
echo "::set-output name=changed::false" | |
else | |
echo "Changes detected in the src folder." | |
echo "::set-output name=changed::true" | |
fi | |
- name: Generate GIF from Website | |
if: steps.check_changes.outputs.changed == 'true' | |
uses: PabloLec/website-to-gif@2.1.1 | |
with: | |
url: "https://mrtysn.github.io/cv/" | |
save_path: "/" | |
file_format: "GIF" | |
file_name: "cv-preview" | |
window_width: 960 | |
window_height: 720 | |
final_width: 640 | |
final_height: 480 | |
scroll_step: 15 | |
time_per_frame: 100 | |
start_delay: 4000 | |
- name: Commit GIF to the Repository | |
if: steps.check_changes.outputs.changed == 'true' | |
id: commit | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git add . | |
if git diff-index --quiet HEAD; then | |
echo "No changes to commit." | |
echo "::set-output name=changed_commit::false" | |
else | |
git commit -m 'Automatically generate GIF of the CV website' | |
echo "::set-output name=changed_commit::true" | |
fi | |
- name: Push changes | |
if: steps.commit.outputs.changed_commit == 'true' | |
run: git push |