change region #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Infrastructure | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: ${{ steps.deploy-url.outputs.deployment-url }} | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install Pulumi CLI | |
run: | | |
curl -fsSL https://get.pulumi.com | sh | |
echo "/home/runner/.pulumi/bin" >> $GITHUB_PATH | |
pulumi version | |
- name: Install Dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Login to Pulumi | |
run: pulumi login | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
- name: Select Stack | |
run: | | |
pulumi stack select dev --create | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
- name: Set Pulumi Config - AWS Region | |
run: | | |
pulumi config set aws:region ap-southeast-3 | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
- name: Pulumi Preview | |
uses: pulumi/actions@v3 | |
with: | |
command: preview | |
stack-name: 'dev' | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Deploy to Dev | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: pulumi/actions@v3 | |
with: | |
command: up | |
stack-name: 'dev' | |
args: --yes | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
id: deploy-url | |
continue-on-error: false # Optional based on your requirement |