@@ -16,20 +16,20 @@ jobs:
1616 name : Build Documentation
1717 runs-on : ubuntu-latest
1818 timeout-minutes : 90
19- outputs :
20- environment : ${{ steps.set-env.outputs.environment }}
2119 steps :
2220 - name : Checkout code
2321 uses : actions/checkout@v4
2422
25- - name : Determine environment
23+ - name : Determine environment and URL
2624 id : set-env
2725 run : |
28- if [[ "${{ github.ref }}" == "refs/heads/main" ]] || [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "main" ]]; then
29- echo "environment=Production" >> $GITHUB_OUTPUT
26+ if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
3027 echo "SITE_URL=${{ secrets.PROD_URL }}" >> $GITHUB_ENV
31- else
32- echo "environment=Development" >> $GITHUB_OUTPUT
28+ elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
29+ echo "SITE_URL=${{ secrets.DEV_URL }}" >> $GITHUB_ENV
30+ elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "main" ]]; then
31+ echo "SITE_URL=${{ secrets.PROD_URL }}" >> $GITHUB_ENV
32+ elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "dev" ]]; then
3333 echo "SITE_URL=${{ secrets.DEV_URL }}" >> $GITHUB_ENV
3434 fi
3535
@@ -46,18 +46,18 @@ jobs:
4646 .docusaurus
4747 .cache
4848 build/.cache
49- key : ${{ runner.os }}-docusaurus-build-${{ steps.set-env.outputs.environment }}-${{ hashFiles('**/package-lock.json', '**/docusaurus.config.js', 'docs/**/*.md', 'docs/**/*.mdx') }}
49+ key : ${{ runner.os }}-docusaurus-build-${{ github.ref_name }}-${{ hashFiles('**/package-lock.json', '**/docusaurus.config.js', 'docs/**/*.md', 'docs/**/*.mdx') }}
5050 restore-keys : |
51- ${{ runner.os }}-docusaurus-build-${{ steps.set-env.outputs.environment }}-
51+ ${{ runner.os }}-docusaurus-build-${{ github.ref_name }}-
5252 ${{ runner.os }}-docusaurus-build-
5353
5454 - name : Cache webpack
5555 uses : actions/cache@v4
5656 with :
5757 path : node_modules/.cache
58- key : ${{ runner.os }}-webpack-${{ steps.set-env.outputs.environment }}-${{ hashFiles('**/package-lock.json') }}
58+ key : ${{ runner.os }}-webpack-${{ github.ref_name }}-${{ hashFiles('**/package-lock.json') }}
5959 restore-keys : |
60- ${{ runner.os }}-webpack-${{ steps.set-env.outputs.environment }}-
60+ ${{ runner.os }}-webpack-${{ github.ref_name }}-
6161 ${{ runner.os }}-webpack-
6262
6363 - name : Install dependencies
7979 - name : Upload build artifacts
8080 uses : actions/upload-artifact@v4
8181 with :
82- name : build-${{ steps.set-env.outputs.environment }}
82+ name : build-${{ github.run_id }}
8383 path : build/
8484 retention-days : 1
8585
@@ -88,26 +88,27 @@ jobs:
8888 needs : build
8989 runs-on : ubuntu-latest
9090 environment : Development
91- if : (github.ref == 'refs/heads/dev' || (github.event_name == 'pull_request' && github.base_ref == 'dev')) && needs.build.outputs.environment == 'Development'
91+ # ONLY run for dev branch pushes or PRs targeting dev
92+ if : github.ref == 'refs/heads/dev' || (github.event_name == 'pull_request' && github.base_ref == 'dev')
9293 permissions :
9394 deployments : write
94- pull-requests : write # Needed to comment on PRs
95+ pull-requests : write
9596 steps :
9697 - name : Download build artifacts
9798 uses : actions/download-artifact@v4
9899 with :
99- name : build-Development
100+ name : build-${{ github.run_id }}
100101 path : build/
101102
102103 - name : Deploy to Render Dev
103104 id : deploy
104105 uses :
JorgeLNJunior/[email protected] 105106 with :
106- service_id : ${{ secrets.RENDER_SERVICE_ID }}
107+ service_id : ${{ secrets.RENDER_DEV_SERVICE_ID }} # Use separate dev service ID
107108 api_key : ${{ secrets.RENDER_API_KEY }}
108109 wait_deploy : true
109110 github_deployment : true
110- deployment_environment : ${{ secrets.RENDER_DEPLOY_ENVIRONMENT }}
111+ deployment_environment : Development
111112 github_token : ${{ secrets.GITHUB_TOKEN }}
112113
113114 - name : Comment on PR
@@ -116,7 +117,7 @@ jobs:
116117 with :
117118 github-token : ${{ secrets.GITHUB_TOKEN }}
118119 script : |
119- const deployUrl = '${{ secrets.SITE_URL }}';
120+ const deployUrl = '${{ secrets.DEV_URL }}';
120121 const environment = 'Development';
121122 const commentIdentifier = `<!-- deployment-bot:${environment} -->`;
122123
@@ -168,26 +169,27 @@ jobs:
168169 needs : build
169170 runs-on : ubuntu-latest
170171 environment : Production
171- if : (github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')) && needs.build.outputs.environment == 'Production'
172+ # ONLY run for main branch pushes or PRs targeting main
173+ if : github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')
172174 permissions :
173175 deployments : write
174- pull-requests : write # Needed to comment on PRs
176+ pull-requests : write
175177 steps :
176178 - name : Download build artifacts
177179 uses : actions/download-artifact@v4
178180 with :
179- name : build-Production
181+ name : build-${{ github.run_id }}
180182 path : build/
181183
182184 - name : Deploy to Render Prod
183185 id : deploy
184186 uses :
JorgeLNJunior/[email protected] 185187 with :
186- service_id : ${{ secrets.RENDER_SERVICE_ID }}
188+ service_id : ${{ secrets.RENDER_PROD_SERVICE_ID }} # Use separate prod service ID
187189 api_key : ${{ secrets.RENDER_API_KEY }}
188190 wait_deploy : true
189191 github_deployment : true
190- deployment_environment : ${{ secrets.RENDER_DEPLOY_ENVIRONMENT }}
192+ deployment_environment : Production
191193 github_token : ${{ secrets.GITHUB_TOKEN }}
192194
193195 - name : Comment on PR
@@ -196,7 +198,7 @@ jobs:
196198 with :
197199 github-token : ${{ secrets.GITHUB_TOKEN }}
198200 script : |
199- const deployUrl = '${{ secrets.SITE_URL }}';
201+ const deployUrl = '${{ secrets.PROD_URL }}';
200202 const environment = 'Production';
201203 const commentIdentifier = `<!-- deployment-bot:${environment} -->`;
202204
0 commit comments