-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 2.83 KB
/
build.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
name: 🏗️ Build Engine
on:
push:
paths:
- 'engine/**'
- '.github/workflows/build.yaml'
env:
REGISTRY: ghcr.io
IMAGE_NAME: v3xlabs/v3x-property-engine
jobs:
deploy:
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
with:
version: "v0.7.4"
- name: Start postgres via docker-compose dev
working-directory: ./engine
run: docker compose -f ./compose.yaml up postgres -d
- name: Setup Env
working-directory: ./engine
run: cp .env.example .env
- name: Get Runner IP
id: get_ip
run: echo "RUNNER_IP=$(hostname -I | awk '{print $1}')" >> $GITHUB_ENV
- name: Migrate db
working-directory: ./engine
run: cargo install sqlx-cli --no-default-features --features native-tls,postgres && sqlx migrate run && cargo sqlx prepare
- name: Stop postgres via docker-compose dev
working-directory: ./engine
run: docker compose -f ./compose.yaml down
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build docker image using github actions
uses: docker/build-push-action@v6
id: push
with:
context: ./engine
file: ./engine/.build/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true