-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (66 loc) · 1.9 KB
/
ci.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
name: Build Pipeline
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "README.md"
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
- "README.md"
concurrency:
group: "${{ github.workflow }} @ ${{ github.head_ref || github.ref }}"
cancel-in-progress: true
env:
CI: true
jobs:
tests:
uses: ./.github/workflows/tests-workflow.yaml
secrets: inherit
format-and-clippy:
uses: ./.github/workflows/format-workflow.yaml
secrets: inherit
build-and-push-docker-image:
runs-on: arc-runner-set
needs: [tests, format-and-clippy]
permissions:
id-token: write
contents: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.CI_AWS_ROLE }}
aws-region: eu-west-1
- uses: actions/checkout@v4
with:
submodules: recursive
token: ${{ secrets.CI_TOKEN }}
- name: Determine short SHA
uses: actions/github-script@v7
id: determined-sha
with:
script: |
const { ref } = context
const isMainBranch = ref === 'refs/heads/main'
let tag;
if(isMainBranch) {
tag = `master`
} else {
tag = ref.startsWith('refs/pull/')
? context.payload.pull_request.head.sha
: context.sha
tag = tag.slice(0, 7)
}
core.setOutput('sha', tag)
- name: Upload to Blueground ECR
env:
ECR_REGISTRY: ${{ secrets.ECR_REGISTRY }}
RUSTIC_WITCHER_DOCKER_IMAGE_TAG: ${{ steps.determined-sha.outputs.sha }}
run: |
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin ${{ env.ECR_REGISTRY }}
make build_and_push_docker_image_bg