Java CI with Maven #3772
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
# This workflow will build a Java project with Maven | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | |
name: Java CI with Maven | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
- cron: '2 7 * * *' | |
# 每天中国时间0点2分 (UTC时间前一天16点2分) | |
- cron: '2 16 * * *' | |
# 每天UTC时间0点2分 | |
- cron: '2 0 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: current date | |
run: date | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Run Java Application | |
run: java -jar target/bing-wallpaper-jar-with-dependencies.jar | |
- name: Commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "niumoo" | |
git pull | |
git add README.md | |
git add bing-wallpaper.md | |
git add picture/* | |
git add docs/* | |
git add zh-cn/* | |
git commit -m "update readme.md" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.MY_GIT_TOKEN }} | |
branch: main |