Skip to content

Commit

Permalink
Merge pull request #222 from valerymelou/chore/cd
Browse files Browse the repository at this point in the history
chore: refactor workflows
  • Loading branch information
valerymelou authored Jul 13, 2024
2 parents 6ce0271 + 7e93a92 commit ec2e6fc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
on:
workflow_call:
inputs:
environment:
required: true
type: string
description: 'The environment to deploy to'

jobs:
deploy:
staging:
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
environment: staging
steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- run: yarn install
- run: npx nx run website:build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
channelId: preview
projectId: ${{ secrets.FIREBASE_PROJECT_ID }}

production:
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v4

Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,7 @@ jobs:
.nx
key: ${{ steps.nx-cache-restore.outputs.cache-primary-key }}

deploy-preview:
if: github.ref == 'refs/heads/develop'
needs: test
uses: ./.github/workflows/cd.yml
secrets: inherit
with:
environment: staging

deploy:
if: github.ref == 'refs/heads/master'
needs: test
uses: ./.github/workflows/cd.yml
secrets: inherit
with:
environment: production

0 comments on commit ec2e6fc

Please sign in to comment.