|
| 1 | +name: Cfnrelease-int |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - int |
| 7 | + |
| 8 | +permissions: # added using https://github.com/step-security/secure-repo |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + publish-test: |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + id-token: write |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Harden Runner |
| 19 | + uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 |
| 20 | + with: |
| 21 | + egress-policy: audit |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 24 | + with: |
| 25 | + fetch-depth: 0 |
| 26 | + - name: Set up Go |
| 27 | + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 |
| 28 | + with: |
| 29 | + go-version: 1.17 |
| 30 | + |
| 31 | + - run: go test ./... -coverpkg=./... |
| 32 | + env: |
| 33 | + PAT: ${{ secrets.PAT }} |
| 34 | + |
| 35 | + - uses: step-security/wait-for-secrets@084b3ae774c0e0003a9307ae4f487c10f1f998fe |
| 36 | + id: wait-for-secrets |
| 37 | + with: |
| 38 | + slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 39 | + secrets: | |
| 40 | + AWS_ACCESS_KEY_ID_INT: |
| 41 | + name: 'AWS access key id' |
| 42 | + description: 'Access key id for secure-repo int' |
| 43 | + AWS_SECRET_ACCESS_KEY_INT: |
| 44 | + name: 'AWS secret access key' |
| 45 | + description: 'Secret access key for secure-repo int' |
| 46 | + AWS_SESSION_TOKEN_INT: |
| 47 | + name: 'AWS session token' |
| 48 | + description: 'Session token for secure-repo int' |
| 49 | +
|
| 50 | + - name: Configure AWS Credentials |
| 51 | + uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df |
| 52 | + with: |
| 53 | + aws-access-key-id: ${{ steps.wait-for-secrets.outputs.AWS_ACCESS_KEY_ID_INT }} |
| 54 | + aws-secret-access-key: ${{ steps.wait-for-secrets.outputs.AWS_SECRET_ACCESS_KEY_INT }} |
| 55 | + aws-session-token: ${{ steps.wait-for-secrets.outputs.AWS_SESSION_TOKEN_INT }} |
| 56 | + aws-region: us-west-2 |
| 57 | + |
| 58 | + - name: Deploy to AWS CloudFormation |
| 59 | + uses: aws-actions/aws-cloudformation-github-deploy@33527b83bddcf6b3f0b135d9550bde8475325c73 |
| 60 | + with: |
| 61 | + name: secure-workflow-api-ecr |
| 62 | + template: cloudformation/ecr.yml |
| 63 | + parameter-overrides: "ResourceName=secure-workflow-api" |
| 64 | + no-fail-on-empty-changeset: "1" |
| 65 | + |
| 66 | + - name: Login to Amazon ECR |
| 67 | + id: login-ecr |
| 68 | + uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 |
| 69 | + |
| 70 | + - name: Build, tag, and push image to Amazon ECR |
| 71 | + env: |
| 72 | + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} |
| 73 | + ECR_REPOSITORY: secure-workflow-api |
| 74 | + IMAGE_TAG: ${{ github.sha }} |
| 75 | + run: | |
| 76 | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . |
| 77 | + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG |
| 78 | + |
| 79 | + - name: Deploy to AWS CloudFormation |
| 80 | + uses: aws-actions/aws-cloudformation-github-deploy@33527b83bddcf6b3f0b135d9550bde8475325c73 |
| 81 | + with: |
| 82 | + name: secure-workflow-api |
| 83 | + template: cloudformation/resources.yml |
| 84 | + parameter-overrides: >- |
| 85 | + ResourceName=secure-workflow-api, |
| 86 | + ImageTag=${{ github.sha }}, |
| 87 | + PAT=${{ secrets.PAT }} |
| 88 | + no-fail-on-empty-changeset: "1" |
| 89 | + |
| 90 | + |
0 commit comments