10
10
push :
11
11
branches :
12
12
- main
13
- pull_request_target :
13
+ pull_request :
14
14
branches :
15
15
- main
16
- types :
17
- - labeled
18
16
merge_group :
19
- workflow_dispatch :
20
17
21
18
defaults :
22
19
run :
33
30
34
31
jobs :
35
32
build :
36
- # This Job should run either on non-`pull_request_target` events,
37
- # or `pull_request_target` event with a `labeled` action with a label named `github_actions:pull-request`
38
- # since we want to run Website Builds on all these occasions. As this allows us to be certain the that builds are passing
39
- if : github.event_name != 'pull_request_target' || github.event.label.name == 'github_actions:pull-request'
40
-
41
33
name : Build on ${{ matrix.os }}
42
34
runs-on : ${{ matrix.os }}
43
35
60
52
61
53
- name : Git Checkout
62
54
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
63
- with :
64
- # Provides the Pull Request commit SHA or the GitHub merge group ref
65
- ref : ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
66
- # We only need to fetch the last commit from the head_ref
67
- # since we're not using the `--filter` operation from turborepo
68
- # We don't use the `--filter` as we always want to force builds regardless of having changes or not
69
- # this ensures that our bundle analysis script always runs and that we always ensure next.js is building
70
- # regardless of having code changes or not
71
- fetch-depth : 1
72
55
73
56
- uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
74
57
with :
@@ -90,59 +73,13 @@ jobs:
90
73
# We only want to install required production packages
91
74
run : pnpm install --prod --frozen-lockfile
92
75
93
- - name : Build Next.js (ISR)
76
+ - name : Build Next.js
94
77
# We want a ISR build on CI to ensure that regular Next.js builds work as expected.
95
78
run : node_modules/.bin/turbo build ${{ env.TURBO_ARGS }}
96
79
env :
97
80
# We want to ensure we have enough RAM allocated to the Node.js process
98
81
# this should be a last resort in case by any chances the build memory gets too high
99
82
# but in general this should never happen
100
83
NODE_OPTIONS : ' --max_old_space_size=4096'
101
- # Used for API requests that require GitHub API scopes
102
- NEXT_GITHUB_API_KEY : ${{ secrets.GITHUB_TOKEN }}
103
-
104
- - name : Build Next.js (Static All Locales)
105
- # We only run full static builds within Pull Requests. This step is also used to export
106
- # static output in all languages, and it only works on `push` events.
107
- if : github.event_name == 'push'
108
- run : node_modules/.bin/turbo deploy ${{ env.TURBO_ARGS }}
109
- env :
110
- # We want to ensure we have enough RAM allocated to the Node.js process
111
- # this should be a last resort in case by any chances the build memory gets too high
112
- # but in general this should never happen
113
- NODE_OPTIONS : ' --max_old_space_size=4096'
114
- # Used for API requests that require GitHub API scopes
115
- NEXT_GITHUB_API_KEY : ${{ secrets.GITHUB_TOKEN }}
116
- # We want to ensure that static exports for all locales are triggered only on `push` events to save resources
117
- # and time.
118
- NEXT_PUBLIC_STATIC_EXPORT_LOCALE : true
119
-
120
- - name : Build Next.js (Static Default Locale)
121
- # We want to generate static output in the default language within Pull Requests
122
- # in order to reduce source wastages and build times.
123
- # Note that we skip full static builds on Crowdin-based Pull Requests as these PRs should only contain translation changes
124
- if : |
125
- (github.event_name == 'pull_request_target' &&
126
- github.event.pull_request.head.ref != 'chore/crowdin')
127
- run : node_modules/.bin/turbo deploy ${{ env.TURBO_ARGS }}
128
- env :
129
- # We want to ensure we have enough RAM allocated to the Node.js process
130
- # this should be a last resort in case by any chances the build memory gets too high
131
- # but in general this should never happen
132
- NODE_OPTIONS : ' --max_old_space_size=4096'
133
- # Used for API requests that require GitHub API scopes
134
- NEXT_GITHUB_API_KEY : ${{ secrets.GITHUB_TOKEN }}
135
- # We want to ensure that static exports for all locales do not occur on `pull_request_target` events
136
- NEXT_PUBLIC_STATIC_EXPORT_LOCALE : false
137
-
138
- - name : Sync Orama Cloud
139
- # We only want to sync the Orama Cloud production indexes on `push` events.
140
- # We also want to sync the Orama Cloud preview (deployment) indexes on `pull_request_target` events (or manual triggers).
141
- # We also want to ensure that the sync only happens on the `ubuntu-latest` runner to avoid duplicate syncs
142
- # or Windows-based path issues.
143
- env :
144
- ORAMA_INDEX_ID : ${{ github.event_name == 'push' && secrets.ORAMA_PRODUCTION_INDEX_ID || secrets.ORAMA_INDEX_ID }}
145
- ORAMA_SECRET_KEY : ${{ github.event_name == 'push' && secrets.ORAMA_PRODUCTION_SECRET_KEY || secrets.ORAMA_SECRET_KEY }}
146
- if : matrix.os == 'ubuntu-latest' && github.event_name != 'merge_group'
147
- working-directory : apps/site
148
- run : node --run sync-orama
84
+ # We want to ensure that static exports for all locales do not occur on `pull_request` events
85
+ NEXT_PUBLIC_STATIC_EXPORT_LOCALE : ${{ github.event_name == 'push' }}
0 commit comments