Skip to content

Commit d6c37fe

Browse files
authored
refactor: move setup steps into deploy-website action (#539)
# Refactor website deployment workflow This PR refactors the website deployment workflow by moving the setup steps into the deploy-website action itself. The changes: 1. Add required inputs to the deploy-website action: - `github-token` - `atlas-cloud-token` 2. Incorporate setup steps directly in the deploy-website action: - Call the setup action - Install the D2 diagramming tool 3. Update workflow files to pass the required tokens to the deploy-website action This approach simplifies the deployment workflows by encapsulating all necessary setup within the deploy-website action, making it more self-contained and reusable.
1 parent 6f94e7b commit d6c37fe

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

.github/actions/deploy-website/action.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: 'Deploy Website'
22
description: 'Deploy website to Cloudflare Pages (preview or production)'
33

44
inputs:
5+
github-token:
6+
description: 'GitHub token for setup'
7+
required: true
8+
atlas-cloud-token:
9+
description: 'Atlas Cloud token for setup'
10+
required: true
511
environment:
612
description: 'Deployment environment (preview or production)'
713
required: true
@@ -37,6 +43,14 @@ inputs:
3743
runs:
3844
using: 'composite'
3945
steps:
46+
- uses: ./.github/actions/setup
47+
with:
48+
github-token: ${{ inputs.github-token }}
49+
atlas-cloud-token: ${{ inputs.atlas-cloud-token }}
50+
51+
- name: Install D2 diagramming tool
52+
uses: ./.github/actions/setup-d2
53+
4054
- name: Validate Supabase environment variables
4155
shell: bash
4256
env:

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,6 @@ jobs:
306306
github-token: ${{ secrets.GITHUB_TOKEN }}
307307
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
308308

309-
- uses: ./.github/actions/setup-d2
310-
311309
- name: Check if website is affected
312310
id: check-affected
313311
run: |
@@ -323,6 +321,8 @@ jobs:
323321
if: steps.check-affected.outputs.affected == 'true'
324322
uses: ./.github/actions/deploy-website
325323
with:
324+
github-token: ${{ secrets.GITHUB_TOKEN }}
325+
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
326326
environment: preview
327327
supabase-url: ${{ secrets.WEBSITE_PREVIEW_SUPABASE_URL }}
328328
supabase-anon-key: ${{ secrets.WEBSITE_PREVIEW_SUPABASE_ANON_KEY }}

.github/workflows/deploy.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@ jobs:
2424
with:
2525
fetch-depth: 0
2626

27-
- uses: ./.github/actions/setup
28-
with:
29-
github-token: ${{ secrets.GITHUB_TOKEN }}
30-
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
31-
3227
- name: Deploy website to production
3328
uses: ./.github/actions/deploy-website
3429
with:
30+
github-token: ${{ secrets.GITHUB_TOKEN }}
31+
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
3532
environment: production
3633
supabase-url: ${{ secrets.WEBSITE_PRODUCTION_SUPABASE_URL }}
3734
supabase-anon-key: ${{ secrets.WEBSITE_PRODUCTION_SUPABASE_ANON_KEY }}

0 commit comments

Comments
 (0)