Skip to content

publish

publish #731

Workflow file for this run

name: publish
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: publish
run: |
git config --global user.name 'ajou-hack-bot'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/ajou-hack/library-new-books
cargo build --release
LAST_ID=$(cat ./last_id)
XML=$(./target/release/library-new-books-rss $LAST_ID xml 2> /dev/null)
MD=$(./target/release/library-new-books-rss $LAST_ID md 2> /dev/null)
CM=$(./target/release/library-new-books-rss $LAST_ID cm 2> /dev/null)
if [ -z "$XML" ] || [ -z "$MD" ] || [ -z "$CM" ]; then
echo "new books not found"
exit 0
fi
echo $XML > rss.xml
echo -e $MD > README.md
cat ./target/release/last_id > ./last_id
git add -A
git commit -m "$CM"
git push origin main