Skip to content

Commit d3190d0

Browse files
authored
Add CI workflow (#4)
1 parent a549858 commit d3190d0

File tree

2 files changed

+164
-0
lines changed

2 files changed

+164
-0
lines changed

.github/workflows/ci.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: build CI
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
build-storybook:
10+
timeout-minutes: 60
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
18+
- name: clean install
19+
run: npm ci
20+
21+
- name: run build
22+
id: build
23+
run: npm run build
24+
25+
- name: Get changed files
26+
id: changed-files
27+
uses: tj-actions/changed-files@v45
28+
with:
29+
separator: " "
30+
31+
- name: Set current datetime as env variable
32+
env:
33+
TZ: 'Asia/Singapore'
34+
run: echo "CURRENT_DATETIME=$(date +'%d %b %Y, %I:%M%p [%A]')" >> $GITHUB_ENV
35+
36+
- name: Send telegram on success
37+
if: ${{ steps.build.outcome == 'success' }}
38+
uses: appleboy/telegram-action@master
39+
with:
40+
to: ${{ secrets.TELEGRAM_TO }}
41+
token: ${{ secrets.TELEGRAM_TOKEN }}
42+
format: markdown
43+
disable_web_page_preview: true
44+
message: |
45+
✅ Build passed!
46+
47+
⏰ *${{ env.CURRENT_DATETIME }}*
48+
49+
📂 ${{ github.ref_name }}
50+
51+
🧑‍💻 *${{ github.actor }}* created commit: ${{ github.event.head_commit.message }}
52+
53+
🗂 *Changed files*:
54+
${{ steps.changed-files.outputs.all_changed_files }}
55+
56+
🎯 *Repository*: ${{ github.repository }}
57+
58+
👍 *See changes*: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
59+
60+
- name: Send telegram update on failure
61+
if: ${{ steps.build.outcome == 'failure' }}
62+
uses: appleboy/telegram-action@master
63+
with:
64+
to: ${{ secrets.TELEGRAM_TO }}
65+
token: ${{ secrets.TELEGRAM_TOKEN }}
66+
format: markdown
67+
disable_web_page_preview: true
68+
message: |
69+
❌ Build failed!
70+
71+
⏰ *${{ env.CURRENT_DATETIME }}*
72+
73+
📂 ${{ github.ref_name }}
74+
75+
🧑‍💻 *${{ github.actor }}* created commit: ${{ github.event.head_commit.message }}
76+
77+
🗂 *Changed files*:
78+
${{ steps.changed-files.outputs.all_changed_files }}
79+
80+
🎯 *Repository*: ${{ github.repository }}
81+
82+
👍 *See changes*: https://github.com/${{ github.repository }}/commit/${{ github.sha }}

.github/workflows/storybook.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: storybook build
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
build:
10+
timeout-minutes: 60
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
18+
- name: clean install
19+
run: npm ci
20+
21+
- name: run build
22+
id: build
23+
run: npm run build-storybook
24+
25+
- name: Get changed files
26+
id: changed-files
27+
uses: tj-actions/changed-files@v45
28+
with:
29+
separator: " "
30+
31+
- name: Set current datetime as env variable
32+
env:
33+
TZ: 'Asia/Singapore'
34+
run: echo "CURRENT_DATETIME=$(date +'%d %b %Y, %I:%M%p [%A]')" >> $GITHUB_ENV
35+
36+
- name: Send telegram on success
37+
if: ${{ steps.build.outcome == 'success' }}
38+
uses: appleboy/telegram-action@master
39+
with:
40+
to: ${{ secrets.TELEGRAM_TO }}
41+
token: ${{ secrets.TELEGRAM_TOKEN }}
42+
format: markdown
43+
disable_web_page_preview: true
44+
message: |
45+
✅ Storybook build passed!
46+
47+
⏰ *${{ env.CURRENT_DATETIME }}*
48+
49+
📂 ${{ github.ref_name }}
50+
51+
🧑‍💻 *${{ github.actor }}* created commit: ${{ github.event.head_commit.message }}
52+
53+
🗂 *Changed files*:
54+
${{ steps.changed-files.outputs.all_changed_files }}
55+
56+
🎯 *Repository*: ${{ github.repository }}
57+
58+
👍 *See changes*: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
59+
60+
- name: Send telegram update on failure
61+
if: ${{ steps.build.outcome == 'failure' }}
62+
uses: appleboy/telegram-action@master
63+
with:
64+
to: ${{ secrets.TELEGRAM_TO }}
65+
token: ${{ secrets.TELEGRAM_TOKEN }}
66+
format: markdown
67+
disable_web_page_preview: true
68+
message: |
69+
❌ Storybook build failed!
70+
71+
⏰ *${{ env.CURRENT_DATETIME }}*
72+
73+
📂 ${{ github.ref_name }}
74+
75+
🧑‍💻 *${{ github.actor }}* created commit: ${{ github.event.head_commit.message }}
76+
77+
🗂 *Changed files*:
78+
${{ steps.changed-files.outputs.all_changed_files }}
79+
80+
🎯 *Repository*: ${{ github.repository }}
81+
82+
👍 *See changes*: https://github.com/${{ github.repository }}/commit/${{ github.sha }}

0 commit comments

Comments
 (0)