-
Notifications
You must be signed in to change notification settings - Fork 191
99 lines (89 loc) · 3.07 KB
/
docker-publish-opr-node-images.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: Push Public Docker images to GHCR with Caching
on:
workflow_dispatch:
inputs:
commit_sha:
description: 'Specific Commit SHA (Required)'
required: true
version:
description: 'Version (Required)'
required: true
gitcommit:
description: 'GitCommit (Required)'
required: true
release_tag:
description: 'Release Tag (Optional)'
required: false
default: ''
env:
REGISTRY: ghcr.io
CACHE-FROM: /tmp/.buildx-cache
CACHE-TO: /tmp/.buildx-cache-new
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository at specified commit
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.commit_sha }}
- name: Get Commit Date
id: get_date
run: |
GIT_DATE=$(git log -1 --format=%cd --date=format:'%Y-%m-%d' ${{ github.event.inputs.gitcommit }} || date '+%Y-%m-%d')
echo "GIT_DATE=$GIT_DATE" >> $GITHUB_ENV
echo "::set-output name=gitDate::$GIT_DATE"
- name: Setup Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
driver-opts: image=moby/buildkit:master
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.event.inputs.commit_sha }}
restore-keys: |
${{ runner.os }}-buildx-
if: ${{ success() }}
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ success() }}
- name: Set Tag Name
id: set_tag
run: echo "tag=${{ github.event.inputs.release_tag || github.event.inputs.commit_sha }}" >> $GITHUB_OUTPUT
if: ${{ success() }}
- name: Build and Push Opr Node Image
uses: docker/build-push-action@v2
with:
file: ./node/cmd/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/layr-labs/eigenda/opr-node:${{ steps.set_tag.outputs.tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
build-args: SEMVER=${{ github.event.inputs.version }},GITCOMMIT=${{ github.event.inputs.gitcommit }},GITDATE=${{ steps.get_date.outputs.gitDate }}
if: ${{ success() }}
- name: Build and Push NodePlugin Image
uses: docker/build-push-action@v2
with:
context: .
file: ./node/plugin/cmd/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/layr-labs/eigenda/opr-nodeplugin:${{ steps.set_tag.outputs.tag }}
cache-from: type=local,src=${{ env.CACHE-FROM }}
cache-to: type=local,dest=${{ env.CACHE-TO }}
if: ${{ success() }}
- name: Update cache
uses: actions/cache@v2
with:
path: ${{ env.CACHE-TO }}
key: ${{ runner.os }}-buildx-${{ steps.set_tag.outputs.tag }}
restore-keys: |
${{ runner.os }}-buildx-