Last active
February 5, 2017 00:03
-
-
Save mjhm/01fe5e1a3daa34bb63c93d58b2875201 to your computer and use it in GitHub Desktop.
semi automatic doc tagging for cdn.rawgit.com links
This file contains hidden or 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
#! /bin/bash | |
# | |
# This script updates links in *.md files that look like | |
# https://cdn.rawgit.com/mygithub/myrepo/doctag201702041450/doc/some_doc.html | |
# to new timestamps and creates the corresponding git tags. | |
# | |
# Run it at root of the repo before checking in changes, and be sure to include `--tags` when you push to remotes. | |
# | |
CURTAG=`cat doc/doctag` | |
NEWTAG=`date '+doctag%Y%m%d%H%M'` | |
# skips updates in "node_modules" and "doc" folders | |
find . -name node_modules -prune -o -name doc -prune -o -name '*.md' -print -exec sed -i '' "s/doctag[0-9]*/$NEWTAG/g" {} \; | |
echo $NEWTAG > doc/doctag | |
git tag -d $CURTAG | |
git tag $NEWTAG | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment