-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (60 loc) · 1.96 KB
/
stable.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
name: Deploy nurax-stable to AWS Elastic Container Service
on:
workflow_dispatch:
inputs:
hyraxTarget:
description: Hyrax ref to use
required: true
default: main
repository_dispatch:
types: [release]
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build_and_deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
AWS_REGION: us-east-2
HYRAX_TARGET: ${{ github.event.inputs.hyraxTarget || github.event.client_payload.ref }}
steps:
- uses: actions/checkout@v3
with:
ref: stable
- uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: arn:aws:iam::${{ secrets.AwsAccount }}:role/GitHubOIDCRole
aws-region: ${{ env.AWS_REGION }}
- run: echo "Building nurax:stable"
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Save git ref info for runtime display
run: |
cat <<__EOC__ > deploy_info.json
{
"branch": "$(git rev-parse --abbrev-ref HEAD)",
"sha": "$(git rev-parse HEAD)",
"last_deployed": "$(date -Iseconds)"
}
__EOC__
cat deploy_info.json
- name: Build, tag, and push image to Amazon ECR
uses: docker/build-push-action@v4
with:
build-args: |
"HYRAX_TARGET=${{ env.HYRAX_TARGET }}"
"RAILS_ENV=production"
"SECRET_KEY_BASE=${{ secrets.SECRET_KEY_BASE }}"
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/nurax:stable
- name: "Force new deployment"
run: aws ecs update-service --cluster nurax --service nurax-stable --force-new-deployment