Skip to content

Commit

Permalink
Update GHA workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Ru Chern Chong committed May 24, 2024
1 parent 18d534b commit 92eaa8d
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/pulumi.preview.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Preview Deployment
name: Pulumi Deploy Preview

on:
push:
branches:
- "*"
- "!main"
pull_request:
types: [ opened, synchronize ]

jobs:
test:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/pulumi.production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Pulumi Deploy Production

on:
push:
branches:
- main
tags:
- 'v*.*.*'

jobs:
test:
runs-on: ubuntu-latest
environment: Preview
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12
cache: 'pip'
- run: pip install -r requirements.txt
- name: Run tests
run: pytest
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
deploy:
runs-on: ubuntu-latest
environment: Preview
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12
cache: 'pip'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ vars.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Create Package for AWS Lambda Layer
run: |
python -m venv python
source python/bin/activate
pip install -r requirements.txt -t python
python create_package_zip.py
- uses: pulumi/actions@v5
with:
command: up
stack-name: production
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
MONGODB_URI: ${{ secrets.MONGODB_URI }}
MONGODB_DB_NAME: ${{ secrets.MONGODB_DB_NAME }}

0 comments on commit 92eaa8d

Please sign in to comment.