|
| 1 | +name: Manual deploy |
| 2 | +concurrency: build_and_deploy_v2_${{ github.ref_name }} # ensures that the job waits for any deployments triggered by the build workflow to finish |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + environment: |
| 8 | + description: Environment to deploy to |
| 9 | + required: true |
| 10 | + type: choice |
| 11 | + default: qa |
| 12 | + options: |
| 13 | + - qa |
| 14 | + - staging |
| 15 | + - production |
| 16 | + image_tag: |
| 17 | + description: Docker image tag to be deployed |
| 18 | + required: true |
| 19 | + |
| 20 | +permissions: |
| 21 | + id-token: write |
| 22 | + pull-requests: write |
| 23 | + |
| 24 | +jobs: |
| 25 | + deploy: |
| 26 | + name: ${{ github.event.inputs.environment }} deployment |
| 27 | + runs-on: ubuntu-latest |
| 28 | + environment: |
| 29 | + name: ${{ github.event.inputs.environment }} |
| 30 | + url: ${{ steps.deploy_app_v2.outputs.deploy-url }} |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Configure AWS credentials |
| 36 | + uses: aws-actions/configure-aws-credentials@v4 |
| 37 | + with: |
| 38 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 39 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 40 | + aws-region: eu-west-2 |
| 41 | + role-to-assume: Deployments |
| 42 | + role-duration-seconds: 3600 |
| 43 | + role-skip-session-tagging: true |
| 44 | + |
| 45 | + - name: Get secrets from AWS ParameterStore |
| 46 | + uses: dkershner6/aws-ssm-getparameters-action@v2 |
| 47 | + with: |
| 48 | + parameterPairs: "/teaching-vacancies/github_action/infra/slack_webhook = SLACK_WEBHOOK" |
| 49 | + |
| 50 | + - name: Deploy App to ${{ github.event.inputs.environment }} |
| 51 | + id: deploy_app_v2 |
| 52 | + uses: ./.github/actions/deploy/ |
| 53 | + with: |
| 54 | + azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 55 | + azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 56 | + azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 57 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 58 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 59 | + environment: ${{ github.event.inputs.environment }} |
| 60 | + tag: ${{ github.event.inputs.image_tag }} |
0 commit comments