diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..86dc7cc --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,45 @@ +name: Deploy to Environment + +on: + workflow_dispatch: + inputs: + environment: + description: 'Target environment' + required: true + type: choice + options: + - staging + - production + version: + description: 'Package version to deploy' + required: true + type: string + +jobs: + deploy: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + permissions: + contents: read + steps: + - name: Checkout infra template + uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + with: + repository: LibreTexts/infrastructure + token: ${{ secrets.LIBREBOT_ACCESS_TOKEN }} + path: infra + persist-credentials: false + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@517a711dbcd0e402f90c77e7e2f81e849156e31d # v6.2.2 + with: + aws-region: us-east-1 + aws-access-key-id: ${{ secrets.AWS_DEPLOY_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_DEPLOY_SECRET_ACCESS_KEY }} + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + - name: Deploy CloudFormation stack + uses: aws-actions/aws-cloudformation-github-deploy@81e3b03d2266bcb76c4bcc37a7d71d9cb67838bb # v2.2.0 + with: + name: ${{ vars.AWS_STACK_NAME }} + template: infra/molview/api.json + capabilities: 'CAPABILITY_NAMED_IAM' + parameter-overrides: 'MolViewApiEnvironment=${{ inputs.environment }},MolViewApiImage=ghcr.io/libretexts/molview-lambda-api:${{ inputs.version }}' \ No newline at end of file