publish #18679
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: publish | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '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/notice-rss | |
cargo build --release | |
LAST_INDEX=$(cat ./last_index) | |
XML=$(./target/release/notice-rss $LAST_INDEX xml 2> /dev/null) | |
CM=$(./target/release/notice-rss $LAST_INDEX cm 2> /dev/null) | |
if [ -z "$XML" ] || [ -z "$CM" ]; then | |
echo "new notices not found" | |
exit 0 | |
fi | |
echo $XML > rss.xml | |
cat ./target/release/last_index > ./last_index | |
git add -A | |
git commit -m "$CM" | |
git push origin master | |