-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (32 loc) · 1003 Bytes
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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