diff --git a/.github/workflows/deploy-to-dev.yml b/.github/workflows/deploy-to-dev.yml deleted file mode 100644 index cb586ab..0000000 --- a/.github/workflows/deploy-to-dev.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Deploy IoT status api to development (staging) server - -on: - workflow_dispatch: - inputs: - environment: - description: Whether the workflow should deploy to production or development server - required: true - default: development - type: choice - options: - - development - - production -jobs: - deploy: - name: Deploy to development staging server - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - - steps: - - name: Checking out the code to the workflow - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - sudo apt-get install jq - npm install -g serverless - npm install - - - 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 ${{ secrets.AWS_SECRET_ARN }} | jq -r ".SecretString" >> dev.env - - - name: Deploy - run: sls deploy --stage dev - - diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..6e84595 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +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: Install dependencies + run: | + sudo apt-get install jq + npm install -g serverless + 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: sls deploy --stage ${{ inputs.environment }} diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..34bfa5c --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +18.19.1 \ No newline at end of file