-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (95 loc) · 3.25 KB
/
dev-deploy.yaml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Dev Deploy
on:
push:
branches:
- dev
- nav/test-runners
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
deploy_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
# Set up Rust
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.80.1
target: aarch64-unknown-linux-gnu
# Cache Rust dependencies
- name: Cache Cargo registry and index
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
# Cache build folder (target)
- name: Cache target directory
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-target-
# Build the project
- name: Install cross-compilation tools
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu libssl-dev:arm64
- name: Cargo Build - aarch64-unknown-linux-gnu
shell: bash
run: |
rustup target add aarch64-unknown-linux-gnu
cargo build --release --locked --target aarch64-unknown-linux-gnu
ls -la ./target
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/[email protected]
with:
platforms: arm64
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::417712557820:role/GithubDeployRole
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.login-ecr.outputs.registry }}/source-data-proxy
tags: |
type=sha
- name: Build and push
id: docker_push
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # ratchet:docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/arm64/v8
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"
- name: Render Amazon ECS task definition
id: render-data-proxy-container
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition-family: source-data-proxy
container-name: source-data-proxy
image: ${{ steps.meta.outputs.tags }}
- name: Deploy to Amazon ECS service
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
with:
task-definition: ${{ steps.render-data-proxy-container.outputs.task-definition }}
service: source-data-proxy
cluster: SourceCooperative-Dev