Skip to content

Version 2.0

Version 2.0 #5

Workflow file for this run

name: Build, Test and Minify
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
- name: Build minified bundle
run: npm run build
- name: Report bundle size
run: npm run size
- name: Commit minified file
if: github.event_name == 'push'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Build: Minify GStime.js"
file_pattern: 'GStime.min.js GStime.min.js.map'
- name: Send success message to Telegram
if: success() && env.TELEGRAM_BOT_TOKEN != ''
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: |
curl -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-d chat_id="${TELEGRAM_CHAT_ID}" \
-d text="🟢 $GITHUB_REPOSITORY [${{ github.event.pusher.name }}] - OK"
- name: Send error message to Telegram
if: failure() && env.TELEGRAM_BOT_TOKEN != ''
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: |
curl -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-d chat_id="${TELEGRAM_CHAT_ID}" \
-d text="🔴 $GITHUB_REPOSITORY [${{ github.event.pusher.name }}] - ERROR"