Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: split up build and deploy steps #2838

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 33 additions & 21 deletions .github/workflows/deploy-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,24 @@ on:
SLACK_WEBHOOK:
required: true


jobs:
deploy:
name: Deploy
build:
name: Build/push Docker Image
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: ${{ inputs.env }}
env:
ECS_CLUSTER: skate
ECS_SERVICE: skate-${{ inputs.env }}
outputs:
docker-tag-suffix: ${{ steps.build-push.outputs.docker-tag-suffix }}
sentry-release: ${{ steps.version-ids.outputs.sentry-release }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
firestack marked this conversation as resolved.
Show resolved Hide resolved
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- uses: actions/checkout@v4
- name: Get version ids
id: version-ids
run: |
echo "sentry-release=${{github.ref}}_${{github.sha}}" | tr / - >> "$GITHUB_OUTPUT"
- uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: ${{ inputs.env }}
version: ${{steps.version-ids.outputs.sentry-release}}
ignore_missing: true
- uses: mbta/actions/build-push-ecr@v2
id: build-push
with:
Expand All @@ -61,13 +48,38 @@ jobs:
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 }}
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: ${{ steps.build-push.outputs.docker-tag }}
- uses: mbta/actions/notify-slack-deploy@v1
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 }}
Expand Down
Loading