-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (130 loc) · 4.55 KB
/
deploy.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
env:
PRODUCTION: true
name: Deploy
run-name: ${{ github.actor }} deploys 🚀
on:
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-node@v4
with:
node-version: '21'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run lint
run: yarn lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-node@v4
with:
node-version: '21'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run test
run: yarn test
build-interactive-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: webdoky/interactive-examples
ref: master
- uses: actions/setup-node@v4
with:
node-version: '18'
- run: yarn install --frozen-lockfile
- run: yarn build
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: interactive-examples
path: ./docs/
build:
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/checkout@v4
with:
repository: webdoky/content
ref: master
path: external/translated-content
- name: copy content
run: |
cp -r ./external/translated-content/files/uk ./src/content/processed-content
find ./src/content/processed-content -name "_*" -type d | while read -r dir; do mv "$dir" "$(dirname "$dir")/-`basename $dir`"; done
# - uses: actions/checkout@v4
# with:
# repository: mdn/content
# ref: main
# path: external/original-content
- uses: actions/setup-node@v4
with:
node-version: '21'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run build
run: npx astro build
env:
BASE_PATH: ${{ vars.BASE_PATH }}
MODE: production
PATH_TO_LOCALIZED_CONTENT: ${{ vars.PATH_TO_LOCALIZED_CONTENT }}
ROLLBAR_ACCESS_TOKEN: ${{ secrets.ROLLBAR_ACCESS_TOKEN }}
TARGET_LOCALE: ${{ vars.TARGET_LOCALE }}
GOOGLE_ANALYTICS_ID: ${{ vars.GOOGLE_ANALYTICS_ID }}
- run: sudo apt install rename
# Recursively replace all asterisks in folder names with "_asterisk_"
- run: find ./dist -depth -name "*" -execdir rename 's/\*/_asterisk_/g' "{}" \;
# Recursively replace all doublecolons in folder names with "_doublecolon_"
- run: find ./dist -depth -name "*" -execdir rename 's/::/_doublecolon_/g' "{}" \;
# Recursively replace all colons in folder names with "_colon_"
- run: find ./dist -depth -name "*" -execdir rename 's/:/_colon_/g' "{}" \;
# Recursively replace all asterisks in folder names with "_star_"
- run: find ./dist -depth -name "*" -execdir rename 's/\*/_star_/g' "{}" \;
- uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: build
path: dist
deploy:
needs: [build, build-interactive-examples]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: build
path: dist
- run: sudo apt install rename
# Recursively replace all "_asterisk_" in folder names with asterisks
- run: find ./dist -depth -name "*_asterisk_*" -execdir rename 's/_asterisk_/*/g' "{}" \;
# Recursively replace all "_doublecolon_" in folder names with doublecolons
- run: find ./dist -depth -name "*_doublecolon_*" -execdir rename 's/_doublecolon_/::/g' "{}" \;
# Recursively replace all "_colon_" in folder names with colons
- run: find ./dist -depth -name "*_colon_*" -execdir rename 's/_colon_/:/g' "{}" \;
# Recursively replace all "_star_" in folder names with asterisks
- run: find ./dist -depth -name "*_star_*" -execdir rename 's/_star_/*/g' "{}" \;
- uses: actions/download-artifact@v4
with:
name: interactive-examples
path: dist/interactive-examples
- uses: actions/setup-node@v4
with:
node-version: '21'
- run: yarn global add surge
- run: npx surge ./dist --domain https://webdoky4.surge.sh
env:
SURGE_LOGIN: ${{ vars.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}