Hexo Auto Submit Urls #30
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: Hexo Auto Submit Urls | |
on: | |
workflow_dispatch: | |
schedule: | |
# 每天上午 9 点 12 分 | |
- cron: '12 1 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Check for GOOGLE_KEY | |
id: check_google_key | |
run: | | |
if [ -z "${{ secrets.GOOGLE_KEY }}" ]; then | |
echo "GOOGLE_KEY secret is not set." | |
echo "::set-output name=should_encode::false" | |
else | |
echo "GOOGLE_KEY secret is set." | |
echo "::set-output name=should_encode::true" | |
fi | |
- name: Write JSON to File | |
if: steps.check_google_key.outputs.should_encode == 'true' | |
run: echo '${{ secrets.GOOGLE_KEY }}' > google_service.json | |
- name: Configure Environment Variables | |
run: | | |
echo "RSS_URL=${{ secrets.RSS_URL }}" >> $GITHUB_ENV | |
echo "INDEX_NOW_KEY=${{ secrets.INDEX_NOW_KEY }}" >> $GITHUB_ENV | |
echo "BING_KEY=${{ secrets.BING_KEY }}" >> $GITHUB_ENV | |
echo "BAIDU_KEY=${{ secrets.BAIDU_KEY }}" >> $GITHUB_ENV | |
echo "BOT_TOKEN=${{ secrets.BOT_TOKEN }}" >> $GITHUB_ENV | |
echo "CHAT_ID=${{ secrets.CHAT_ID }}" >> $GITHUB_ENV | |
- name: Run Submit Urls | |
run: | | |
mvn compile exec:java -Dexec.mainClass="cn.imzjw.AutoSubmitUrlApplications" | |
- name: Clean Up Files | |
run: | | |
if [ -f urls.txt ]; then rm -f urls.txt; echo "urls.txt file deleted."; fi | |
if [ -f google_service.json ]; then rm -f google_service.json; echo "google_service.json file deleted."; fi |