Skip to content

Commit

Permalink
Merge pull request #20 from serverless/setup-github-oidc
Browse files Browse the repository at this point in the history
chore(github): setup Github oidc
  • Loading branch information
eahefnawy authored Oct 15, 2024
2 parents d5b0f1b + a63b141 commit 3ce5c0a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches:
- main

permissions:
id-token: write
contents: write
pull-requests: write

jobs:
deploy:
name: deploy-prod
Expand All @@ -24,11 +29,14 @@ jobs:
cmd: |
yq -i '.stages.prod.params.customDomainName = "${{ vars.CUSTOM_DOMAIN_NAME }}"' serverless-compose.yml
yq -i '.stages.prod.params.customDomainCertificateARN = "${{ vars.CUSTOM_DOMAIN_CERTIFICATE_ARN }}"' serverless-compose.yml
- name: Serverless Deploy
- name: Configure AWS Credentials - Serverless Marketing AWS Account
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::488110005556:role/GithubActionsDeploymentRole
aws-region: us-east-1
- name: Serverless Deploy - Prod
uses: serverless/github-action@v4
with:
args: deploy --stage prod
env:
SERVERLESS_LICENSE_KEY: ${{ secrets.SERVERLESS_LICENSE_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
14 changes: 11 additions & 3 deletions .github/workflows/pr-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches:
- main

permissions:
id-token: write
contents: write
pull-requests: write

jobs:
remove:
name: deploy-pr-preview
Expand All @@ -18,11 +23,14 @@ jobs:
cache: "npm"
- name: Install dependencies
run: npm ci
- name: serverless deploy
- name: Configure AWS Credentials - Serverless Marketing AWS Account
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::488110005556:role/GithubActionsDeploymentRole
aws-region: us-east-1
- name: Serverless Deploy - PR Preview
uses: serverless/github-action@v4
with:
args: deploy --stage pr-${{ github.event.pull_request.number }}
env:
SERVERLESS_LICENSE_KEY: ${{ secrets.SERVERLESS_LICENSE_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
14 changes: 11 additions & 3 deletions .github/workflows/pr-remove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
types:
- closed

permissions:
id-token: write
contents: write
pull-requests: write

jobs:
remove:
name: remove-pr-preview
Expand All @@ -18,11 +23,14 @@ jobs:
cache: "npm"
- name: Install dependencies
run: npm ci
- name: serverless remove
- name: Configure AWS Credentials - Serverless Marketing AWS Account
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::488110005556:role/GithubActionsDeploymentRole
aws-region: us-east-1
- name: Serverless Remove - PR Preview
uses: serverless/github-action@v4
with:
args: remove --stage pr-${{ github.event.pull_request.number }}
env:
SERVERLESS_LICENSE_KEY: ${{ secrets.SERVERLESS_LICENSE_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

0 comments on commit 3ce5c0a

Please sign in to comment.