Run Selenium Java application built with Maven #172
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: Run Selenium Java application built with Maven | |
on: | |
# push: # commment for easy access | |
# branches: | |
# - dev | |
# pull_request: | |
# branches: | |
# - master | |
schedule: | |
- cron: "0 1 * * *" # it will be 6~7 am in our timezone | |
jobs: | |
run-selenium-script: | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "temurin" | |
java-version: "11" | |
- name: Set up Chrome browser | |
run: google-chrome --version | |
# Cache Maven dependencies (to improve build times) | |
- name: Cache Maven dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
# Install dependencies with Maven | |
- name: Build with Maven | |
run: mvn install | |
# Run Selenium script using Maven and Send Telegram notification | |
- name: Run Selenium script & Notify via Telegram | |
run: | | |
mvn exec:java -Dexec.mainClass="eclass.kr.DeadlineNotifier" > OUTPUT.txt | |
curl -s -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage -d chat_id=${{ secrets.TELEGRAM_CHAT_ID }} -d text="$(sed -n '/Today/,/^Bye/{/^Bye/d;p}' OUTPUT.txt)" | |
env: | |
ID: ${{ secrets.ID }} | |
PASSWORD: ${{ secrets.PASSWORD }} |