-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (46 loc) · 1.62 KB
/
ci-cd.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v2
# Set up Java 11
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: "temurin"
java-version: "11"
# Set up Chrome browser (already installed on GitHub runners)
- 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 }}