Skip to content

Commit

Permalink
Only modify changed or added files - not deleted ones (#967)
Browse files Browse the repository at this point in the history
  • Loading branch information
tunetheweb committed Jul 6, 2020
1 parent b5e6556 commit 4f7b6ca
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/generate_chapters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
echo "files changed in commit $COMMIT_SHA:"
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA
echo "Incrementing any references to changed CSS files"
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA src/static/css | grep "\.css" | sed 's!.*/!!' | sed "s/\(.*\)/s\/\1?v=[0-9][0-9]*\/\1?v=$(date +%Y%m%d%H%M%S)\//" | sed -f - -i src/templates/base/*/*.html
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA src/static/css | grep "\.css" | sed 's!.*/!!' | sed "s/\(.*\)/s\/\1?v=[0-9][0-9]*\/\1?v=$(date +%Y%m%d%H%M%S)\//" | sed -f - -i src/templates/base.html
git diff-tree --diff-filter=AM --no-commit-id --name-only -r $COMMIT_SHA src/static/css | grep "\.css" | sed 's!.*/!!' | sed "s/\(.*\)/s\/\1?v=[0-9][0-9]*\/\1?v=$(date +%Y%m%d%H%M%S)\//" | sed -f - -i src/templates/base/*/*.html
git diff-tree --diff-filter=AM --no-commit-id --name-only -r $COMMIT_SHA src/static/css | grep "\.css" | sed 's!.*/!!' | sed "s/\(.*\)/s\/\1?v=[0-9][0-9]*\/\1?v=$(date +%Y%m%d%H%M%S)\//" | sed -f - -i src/templates/base.html
git diff
- name: Update JS version for modified CSS files
env:
Expand All @@ -47,8 +47,8 @@ jobs:
echo "files changed in commit $COMMIT_SHA:"
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA
echo "Incrementing any references to changed JS files"
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA src/static/js | grep "\.js" | sed 's!.*/!!' | sed "s/\(.*\)/s\/\1?v=[0-9][0-9]*\/\1?v=$(date +%Y%m%d%H%M%S)\//" | sed -f - -i src/templates/base/*/*.html
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA src/static/js | grep "\.js" | sed 's!.*/!!' | sed "s/\(.*\)/s\/\1?v=[0-9][0-9]*\/\1?v=$(date +%Y%m%d%H%M%S)\//" | sed -f - -i src/templates/base.html
git diff-tree --diff-filter=AM --no-commit-id --name-only -r $COMMIT_SHA src/static/js | grep "\.js" | sed 's!.*/!!' | sed "s/\(.*\)/s\/\1?v=[0-9][0-9]*\/\1?v=$(date +%Y%m%d%H%M%S)\//" | sed -f - -i src/templates/base/*/*.html
git diff-tree --diff-filter=AM --no-commit-id --name-only -r $COMMIT_SHA src/static/js | grep "\.js" | sed 's!.*/!!' | sed "s/\(.*\)/s\/\1?v=[0-9][0-9]*\/\1?v=$(date +%Y%m%d%H%M%S)\//" | sed -f - -i src/templates/base.html
git diff
- name: Update timestamp for modified files
env:
Expand All @@ -57,10 +57,10 @@ jobs:
echo "files changed in commit $COMMIT_SHA:"
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA
echo "Updating timestamp in any markdown chapter files"
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA src/content | grep "^src\/content\/[a-z]*\/[0-9]*\/[a-z0-9-]*.md" | xargs -r sed -i "s/^last_updated: [0-9-]*T/last_updated: $(date '+%Y-%m-%d')T/"
git diff-tree --diff-filter=AM --no-commit-id --name-only -r $COMMIT_SHA src/content | grep "^src\/content\/[a-z]*\/[0-9]*\/[a-z0-9-]*.md" | xargs -r sed -i "s/^last_updated: [0-9-]*T/last_updated: $(date '+%Y-%m-%d')T/"
echo "Updating timestamp in any template files"
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA src/templates | grep "^src\/templates\/[a-z][a-z]\/20[0-9][0-9]\/[a-zA-Z0-9_]*.html" | xargs -r sed -i "s/{% block date_modified %}[0-9-]*T/{% block date_modified %}$(date '+%Y-%m-%d')T/"
git diff-tree --no-commit-id --name-only -r $COMMIT_SHA src/templates | grep "^src\/templates\/[a-z][a-z]\/[a-zA-Z0-9_]*.html" | xargs -r sed -i "s/{% block date_modified %}[0-9-]*T/{% block date_modified %}$(date '+%Y-%m-%d')T/"
git diff-tree --diff-filter=AM --no-commit-id --name-only -r $COMMIT_SHA src/templates | grep "^src\/templates\/[a-z][a-z]\/20[0-9][0-9]\/[a-zA-Z0-9_]*.html" | xargs -r sed -i "s/{% block date_modified %}[0-9-]*T/{% block date_modified %}$(date '+%Y-%m-%d')T/"
git diff-tree --diff-filter=AM --no-commit-id --name-only -r $COMMIT_SHA src/templates | grep "^src\/templates\/[a-z][a-z]\/[a-zA-Z0-9_]*.html" | xargs -r sed -i "s/{% block date_modified %}[0-9-]*T/{% block date_modified %}$(date '+%Y-%m-%d')T/"
echo "Updated timestamps:"
git diff
- name: Setup Node.js for use with actions
Expand Down

0 comments on commit 4f7b6ca

Please sign in to comment.