Skip to content

Commit 01148a7

Browse files
committed
2236
1 parent 120fe1d commit 01148a7

File tree

4 files changed

+78
-2
lines changed

4 files changed

+78
-2
lines changed

.github/workflows/aws-deploy.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Deploy to AWS
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '18'
20+
cache: 'npm'
21+
22+
- name: Install Node.js dependencies
23+
run: npm ci
24+
25+
- name: Run Gulp tasks
26+
run: npx gulp
27+
28+
- name: Setup Ruby
29+
uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: '3.2'
32+
bundler-cache: true
33+
34+
- name: Build Jekyll site
35+
run: bundle exec jekyll build
36+
37+
- name: Configure AWS credentials
38+
uses: aws-actions/configure-aws-credentials@v2
39+
with:
40+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
41+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
42+
aws-region: us-east-1
43+
44+
- name: Deploy to S3
45+
run: aws s3 sync ./_site/ s3://learn-english.dev --delete
46+
47+
- name: Invalidate CloudFront cache
48+
run: |
49+
aws cloudfront create-invalidation \
50+
--distribution-id ${{ secrets.DISTRIBUTION_ID }} \
51+
--paths "/*"
52+
53+
- name: Send Slack notification
54+
uses: slackapi/[email protected]
55+
with:
56+
payload: |
57+
{
58+
"text": "🚀 程序员英语词汇宝典已成功部署!",
59+
"blocks": [
60+
{
61+
"type": "section",
62+
"text": {
63+
"type": "mrkdwn",
64+
"text": "*程序员英语词汇宝典已成功部署!* 🚀\n网站: <https://learn-english.dev|learn-english.dev>"
65+
}
66+
}
67+
]
68+
}
69+
env:
70+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
71+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
File renamed without changes.

.github/workflows/main.yml renamed to .github/workflows/main.yml.disabled

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & Deploy
1+
name: Deploy to AWS
22

33
on:
44
push:

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
"dependencies": {
1010
"autoprefixer": "^10.4.14",
1111
"postcss": "^8.4.24",
12-
"tailwindcss": "^3.3.2"
12+
"tailwindcss": "^3.3.2",
13+
"gulp": "^4.0.2",
14+
"gulp-load-plugins": "^2.0.8",
15+
"gulp-cache-bust": "^1.4.1",
16+
"gulp-htmlmin": "^5.0.1",
17+
"gulp-clean-css": "^4.3.0"
1318
},
1419
"engines": {
1520
"node": ">=18.0.0"

0 commit comments

Comments
 (0)