-
Notifications
You must be signed in to change notification settings - Fork 4
87 lines (72 loc) · 2.56 KB
/
build-docker-images.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
name: Build Docker Images
on:
push:
branches:
- main
paths:
- ".github/tags.yaml"
- ".github/builder.py"
- ".github/workflows/build-docker-images.yml"
workflow_dispatch: {}
permissions:
id-token: write
contents: read
jobs:
build-docker-images:
environment: Configure CI/CD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: 'projects/688237091507/locations/global/workloadIdentityPools/oidc-github-identity-pool/providers/oidc-github-provider'
service_account: '[email protected]'
- name: 'Set up GCP CLI'
uses: 'google-github-actions/setup-gcloud@v1'
- name: 'GCP CLI Info'
run: |
gcloud info
gcloud auth list --filter=status:ACTIVE --format="value(account)"
- name: 'GCP set project'
run: |
gcloud config set project lavanet-public
- name: 'Authenticate to Google Artifact'
run: |
gcloud auth configure-docker us-central1-docker.pkg.dev
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# build all
- name: Build, tag, and push docker image to GCP
run: |
export TAGS=$(cat .github/tags.yaml | yq e ".tags" -o json -P -)
export USE_CACHE="true"
python3 .github/builder.py
# get lavad
- name: "Get lavad"
run: |
export VERSION=$(cat .github/tags.yaml | yq e ".tags[2]" -o json - -r)
mkdir bin
curl -L -o bin/lavad https://github.com/lavanet/lava/releases/download/$VERSION/lavad-$VERSION-linux-amd64
chmod +x bin/lavad
# tag latest
- name: "Tag latest branch"
run: |
python3 .github/tag_latest.py "lava-consumer"
python3 .github/tag_latest.py "lava-provider"
# Necessary if you don't want your cache to grow forever, until
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache || true
mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true