Skip to content

Commit f015a8f

Browse files
authored
ci: add deploy workflow (#2274)
1 parent 1e9ecd1 commit f015a8f

8 files changed

Lines changed: 69 additions & 24 deletions

File tree

.github/workflows/build.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ on:
44
pull_request:
55
branches:
66
- redesign
7+
- main
78
pull_request_review:
89
types: [submitted]
910
push:
1011
branches:
1112
- redesign
13+
- main
1214

1315
# Cancel in progress workflows
1416
# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run
@@ -60,37 +62,34 @@ jobs:
6062
with:
6163
persist-credentials: false
6264

63-
- name: Set up Node.js
64-
uses: actions/setup-node@v6
65+
- name: Build Astro site
66+
uses: withastro/action@v6
6567
with:
66-
node-version-file: '.nvmrc'
67-
cache: 'npm'
68-
69-
- name: Install Node.js dependencies
70-
run: npm ci
68+
path: .
69+
package-manager: npm
70+
out-dir: dist
7171

72-
- name: Build Astro site
73-
run: npm run build
72+
- name: Upload build artifact for linkChecker
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: site-dist
76+
path: dist/
77+
if-no-files-found: error
7478

7579
linkChecker:
80+
needs: build
7681
runs-on: ubuntu-latest
7782
steps:
7883
- name: Checkout
7984
uses: actions/checkout@v6
8085
with:
8186
persist-credentials: false
8287

83-
- name: Set up Node.js
84-
uses: actions/setup-node@v6
88+
- name: Download build artifact
89+
uses: actions/download-artifact@v4
8590
with:
86-
node-version-file: '.nvmrc'
87-
cache: 'npm'
88-
89-
- name: Install Node.js dependencies
90-
run: npm ci
91-
92-
- name: Build Astro site
93-
run: npm run build
91+
name: site-dist
92+
path: dist/
9493

9594
- name: Check links
9695
uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2.7.0

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ name: 'CodeQL'
1313

1414
on:
1515
push:
16-
branches: ['gh-pages']
16+
branches: ['main']
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: ['gh-pages']
19+
branches: ['main']
2020
schedule:
2121
- cron: '0 0 * * 1'
2222

.github/workflows/crowdin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Crowdin Upload
22

33
on:
44
push:
5-
branches: [gh-pages]
5+
branches: [main]
66
workflow_dispatch:
77

88
permissions:

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy Website
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: 'deploy-${{ github.ref }}'
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
name: build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v6
25+
26+
- name: Build and upload pages artifact
27+
uses: withastro/action@v6
28+
with:
29+
path: .
30+
package-manager: npm
31+
out-dir: dist
32+
33+
deploy:
34+
name: deploy
35+
needs: build
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: github-pages
39+
url: ${{ steps.deployment.outputs.page_url }}
40+
steps:
41+
- name: Deploy to GitHub Pages
42+
id: deployment
43+
uses: actions/deploy-pages@v4

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
schedule:
1313
- cron: '20 7 * * 2'
1414
push:
15-
branches: ['gh-pages']
15+
branches: ['main']
1616

1717
# Declare default permissions as read only.
1818
permissions: read-all

.github/workflows/sync-orama.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ on:
55
push:
66
branches:
77
- redesign
8+
- main
89
pull_request:
910
branches:
1011
- redesign
12+
- main
1113

1214
permissions:
1315
contents: read

CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
expressjs.com

src/pages/[lang]/blog/[slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const relatedPosts = [...tagged, ...untagged].slice(0, 3);
6868
as="a"
6969
variant="secondary"
7070
size="sm"
71-
href={`https://github.com/expressjs/expressjs.com/edit/gh-pages/src/content/blog/${Astro.params.slug}`}
71+
href={`https://github.com/expressjs/expressjs.com/edit/main/src/content/blog/${Astro.params.slug}`}
7272
>
7373
<Icon name="github" aria-hidden="true" />
7474
{t('page.editOnGitHub')}

0 commit comments

Comments
 (0)