-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (70 loc) · 2.42 KB
/
build.yml
File metadata and controls
87 lines (70 loc) · 2.42 KB
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
name: Build
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
env:
AWS_DEFAULT_REGION: ap-southeast-2
jobs:
build:
name: build
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'nogha') && !contains(github.event.head_commit.message, 'nobuild')"
strategy:
matrix:
os: ["ubuntu-20.04"]
steps:
- uses: actions/checkout@v3
- name: Init runner
run: .github/workflows/scripts/runner-init.sh
- name: Cache build image
uses: actions/cache@v3
continue-on-error: false
with:
path: image-build.tgz
key: ansilo-build-${{ runner.os }}-${{ hashFiles('.github/workflows/docker/build.ubi9.Dockerfile', '.github/workflows/scripts/build-build-image.sh') }}
- name: Cache maven registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.m2
key: ansilo-release-package-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
- name: Build base image
run: .github/workflows/scripts/build-build-image.sh
- uses: Swatinem/rust-cache@v2
- name: Create volume dirs
run: .github/workflows/scripts/volumes.sh
- name: Cargo build
run: |
docker run \
-v $HOME/.cargo:/home/build/.cargo \
-v $HOME/.m2:/home/build/.m2 \
-v $PWD:/build/ \
-w /build/ \
ansilo-build /build/.github/workflows/scripts/release-build.sh
- name: Build release image
run: |
docker build -t ansilo-release \
--file .github/workflows/docker/release.ubi9.Dockerfile .
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
aws-region: ap-southeast-2
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
- name: Push to Amazon ECR
env:
REGISTRY: 635198228996.dkr.ecr.ap-southeast-2.amazonaws.com
REPOSITORY: ansilo-dev
IMAGE_TAG: ${{ github.head_ref || github.ref_name }}
run: |
docker tag ansilo-release $REGISTRY/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG