Skip to content

Commit

Permalink
ci: move environment to reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
WarFox committed Jan 1, 2024
1 parent 67ea070 commit 92d2763
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
21 changes: 4 additions & 17 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,20 @@ jobs:
arguments: --ignore-urls "https://twitter.com/deepumohanp,https://www.linkedin.com/in/deepumohanp/,/tech/,/cv/"

staging:
runs-on: ubuntu-latest

environment:
name: staging
url: https://staging.deepumohan.com

needs: html-proofer

uses: ./.github/workflows/deployment.yaml
with:
s3-bucket: s3://staging.deepumohan.com
environment: staging
s3-bucket: staging.deepumohan.com
secrets:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME_STAGING }}

production:
runs-on: ubuntu-latest

if: github.ref == 'refs/heads/main'

environment:
name: production
url: https://deepumohan.com

needs: staging

uses: ./.github/workflows/deployment.yaml
with:
s3-bucket: s3://deepumohan.com
environment: production
s3-bucket: deepumohan.com
secrets:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME_PRODUCTION }}
8 changes: 8 additions & 0 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ name: Deploy
on:
workflow_call:
inputs:
environment:
required: true
type: string
s3-bucket:
required: true
type: string
Expand All @@ -14,6 +17,11 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest

environment:
name: ${{ input.environment }}
url: https://${{ input.s3-bucket }}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down

0 comments on commit 92d2763

Please sign in to comment.