Deploy to prod #12
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 IoT Status API | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Deployment environment | |
required: true | |
default: dev | |
type: choice | |
options: | |
- dev | |
- prod | |
run-name: Deploy to ${{ inputs.environment }} | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".node-version" | |
cache: "npm" | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: ".python-version" | |
- name: Install dependencies | |
run: | | |
sudo apt-get install jq | |
npm ci | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4.0.2 | |
with: | |
aws-region: eu-west-1 | |
role-to-assume: ${{ secrets.ROLE_OIDC }} | |
- name: Retrieve AWS secrets | |
run: | | |
aws secretsmanager get-secret-value --secret-id "streamingStatusApi/env/${{ inputs.environment }}" | jq -r ".SecretString" >> ${{ inputs.environment }}.env | |
- name: Deploy | |
run: | | |
npm exec -- sls --version | |
npm exec -- sls deploy --stage ${{ inputs.environment }} |