-
Notifications
You must be signed in to change notification settings - Fork 9
87 lines (83 loc) · 2.66 KB
/
deploy-base.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
on:
workflow_call:
inputs:
env:
required: true
type: string
secrets:
AWS_ROLE_ARN:
required: true
DOCKER_REPO:
required: true
SENTRY_AUTH_TOKEN:
required: true
SENTRY_ORG:
required: true
SENTRY_PROJECT:
required: true
SLACK_WEBHOOK:
required: true
jobs:
build:
name: Build/push Docker Image
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
outputs:
docker-tag-suffix: ${{ steps.build-push.outputs.docker-tag-suffix }}
sentry-release: ${{ steps.version-ids.outputs.sentry-release }}
steps:
- uses: actions/checkout@v4
- name: Get version ids
id: version-ids
run: |
echo "sentry-release=${{github.ref}}_${{github.sha}}" | tr / - >> "$GITHUB_OUTPUT"
- uses: mbta/actions/build-push-ecr@v2
id: build-push
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
docker-repo: ${{ secrets.DOCKER_REPO }}
docker-additional-args: --build-arg SENTRY_RELEASE=${{steps.version-ids.outputs.sentry-release}}
- name: Upload static assets to S3
run: bash upload_assets.sh ${{ steps.build-push.outputs.docker-tag }} ${{steps.version-ids.outputs.sentry-release}}
env:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
deploy_ecs:
name: Deploy (ECS)
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write
environment: ${{ inputs.env }}
concurrency:
group: ${{ inputs.env }}
env:
ECS_CLUSTER: skate
ECS_SERVICE: skate-${{ inputs.env }}
steps:
- uses: mbta/actions/deploy-ecs@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
ecs-cluster: ${{ env.ECS_CLUSTER }}
ecs-service: ${{ env.ECS_SERVICE }}
docker-tag: ${{ secrets.DOCKER_REPO }}:${{ needs.build.outputs.docker-tag-suffix }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: getsentry/action-release@v1
env:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
environment: ${{ inputs.env }}
version: ${{needs.build.outputs.sentry-release}}
ignore_missing: true
- uses: mbta/actions/notify-slack-deploy@v2
if: ${{ !cancelled() }}
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK }}
job-status: ${{ job.status }}