-
Notifications
You must be signed in to change notification settings - Fork 6
88 lines (70 loc) · 2.61 KB
/
ci.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
88
name: analysis core ci
on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main
permissions:
id-token: write
contents: read
jobs:
lint:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- env:
REPO_DIR : /opt/analysis-core
run: |
docker build --build-arg REPO_DIR="$REPO_DIR" --target setup-env -t lint-image .
docker run --name lint-container lint-image
docker cp lint-container:"$REPO_DIR"/lint.log .
echo "MSG_COUNT=$(wc -l lint.log | awk '{print $1}')" >> "$GITHUB_ENV"
- if: ${{ env.MSG_COUNT != 0 }}
run: |
while IFS= read -r LINT_MSG; do echo "::warning::${LINT_MSG}"; done < lint.log
exit 1
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
tags: tmp-tag
outputs: type=docker,dest=/tmp/image.tar
- uses: actions/upload-artifact@v4
with:
name: image-artifact
path: /tmp/image.tar
docker-push:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: docker-build
runs-on: ubuntu-latest
steps:
- env:
AWS_REGION : us-east-1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_ROLE }}
aws-region: ${{ env.AWS_REGION }}
- id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- uses: actions/download-artifact@v4
with:
name: image-artifact
path: /tmp
- env:
AWS_REGISTRY : ${{ steps.login-ecr.outputs.registry }}
AWS_REPO : analysis-core
IMG_TAG : latest
run: |
docker load --input /tmp/image.tar
docker image tag tmp-tag $AWS_REGISTRY/$AWS_REPO:$IMG_TAG
docker push $AWS_REGISTRY/$AWS_REPO:$IMG_TAG