Update #115
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: Update | |
on: | |
workflow_dispatch: | |
schedule: | |
# Once a week on Saturday | |
- cron: '5 14 * * 6' | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup python environment | |
run: conda create --quiet --name rse | |
- name: Install Development RSE | |
run: | | |
export PATH="/usr/share/miniconda/bin:$PATH" | |
source activate rse | |
git clone https://github.com/rseng/rse | |
cd rse | |
pip install .[all] | |
cd ../ | |
rm -rf rse | |
- name: Update Web Interface | |
run: | | |
export PATH="/usr/share/miniconda/bin:$PATH" | |
source activate rse | |
git clone https://github.com/rseng/software | |
cd software | |
rse export --type jekyll-web ../ | |
cd ../ | |
rm -rf software | |
- name: Push Changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
printf "GitHub Actor: ${GITHUB_ACTOR}\n" | |
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
git fetch | |
git branch | |
git config --global user.name "github-actions" | |
git config --global user.email "github-actions@users.noreply.github.com" | |
git checkout main | |
git add _software/* | |
git status | |
if git diff-index --quiet HEAD --; then | |
printf "No changes\n" | |
else | |
printf "Changes\n" | |
git commit -a -m "Automated deployment to update software and UI $(date '+%Y-%m-%d')" | |
git push origin main | |
fi |