Pull latest UShER Source #1187
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: Pull latest UShER Source | |
on: | |
schedule: | |
# Run twice a day | |
- cron: '0 0,12 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# Grab the latest UShER | |
- name: Checkout UShER | |
uses: actions/checkout@v2 | |
with: | |
repository: yatisht/usher | |
path: latest-usher | |
- name: Get version SHA of latest UShER commit | |
id: getversion | |
run: | | |
export OLD_VERSION=$(cat usher_version.txt) | |
export NEW_VERSION=$(git ls-remote https://github.com/yatisht/usher | grep HEAD | cut -f1) | |
echo "::set-output name=is_new_version::$(test $OLD_VERSION == $NEW_VERSION && echo FALSE || echo TRUE)" | |
echo "::set-output name=usher_version::$NEW_VERSION" | |
echo $NEW_VERSION > usher_version.txt | |
- name: Modify usher_common.cpp (remove a line that breaks ShUShER) | |
run: sed -i 's/path = boost::filesystem::canonical(outdir);//g' latest-usher/src/usher_common.cpp | |
if: ${{ steps.getversion.outputs.is_new_version == 'TRUE' }} | |
- name: Copy latest UShER into ShUShER repo | |
run: | | |
mv usher-port/src/js . | |
rm -rf usher-port/src/* | |
mv js usher-port/src | |
cp -r latest-usher/src/* usher-port/src | |
if: ${{ steps.getversion.outputs.is_new_version == 'TRUE' }} | |
- name: Update README with UShER version | |
run: | | |
export REPLACE="<a target=\"_blank\" href=\"https:\/\/github.com\/yatisht\/usher\/tree\/${{ steps.getversion.outputs.usher_version }}\"><img src=\"https:\/\/img.shields.io\/badge\/UShER%20Version-commit%20$( head -c 8 usher_version.txt )-%235e0000\"\/><\/a> <a href=\"https:\/\/joss.theoj.org\/papers\/03edfaa561a1cfbc53be7d98c8461cf3\"><img src=\"https:\/\/joss.theoj.org\/papers\/03edfaa561a1cfbc53be7d98c8461cf3\/status.svg\"><\/a>" | |
sed -n '/BEGIN_USHER_BADGE/{p;:a;N;/END_USHER_BADGE/!ba;s/.*\n/'"$REPLACE"'\n/};p' README.md > tmp | |
cat tmp > README.md | |
if: ${{ steps.getversion.outputs.is_new_version == 'TRUE' }} | |
- name: Commit new source | |
uses: EndBug/[email protected] | |
with: | |
add: 'usher-port/src usher_version.txt README.md' | |
author_name: 'Alex Kramer' | |
author_email: '[email protected]' | |
message: 'auto-update to UShER commit ${{ steps.getversion.outputs.usher_version }}' | |
if: ${{ steps.getversion.outputs.is_new_version == 'TRUE' }} | |