-
Notifications
You must be signed in to change notification settings - Fork 360
123 lines (104 loc) · 3.56 KB
/
docker-publish.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Docker
on:
release:
types: [released]
workflow_dispatch:
inputs:
tag:
required: false
description: Tag/version to publish
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
jobs:
deploy:
name: Build and push Docker image
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up NodeJS
uses: actions/setup-node@v4
with:
node-version: "18.17.0"
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22.6"
id: go
- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}
- name: Extract version
shell: bash
run: |
if [ "${{ github.event.inputs.tag }}" != "" ]; then
echo "tag=$(echo ${{ github.event.inputs.tag }} | sed s/^v//)" >> $GITHUB_OUTPUT
else
echo "tag=$(echo ${GITHUB_REF##*/} | sed s/^v//)" >> $GITHUB_OUTPUT
fi
id: version
- name: Generate code
run: make gen VERSION=${{ steps.version.outputs.tag }}
- name: Checks validator
run: make checks-validator
env:
GOLANGCI_LINT_FLAGS: --out-format github-actions
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: lakefs docker metadata
id: lakefs_meta
uses: docker/metadata-action@v5
with:
images: |
treeverse/lakefs
${{ steps.login-ecr.outputs.registry }}/lakefs
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.tag }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.tag }}
type=semver,pattern={{major}},value=${{ steps.version.outputs.tag }}
- name: Build and push lakefs
uses: docker/build-push-action@v5
with:
context: .
target: lakefs
push: true
platforms: linux/amd64,linux/arm64
build-args: VERSION=${{ steps.version.outputs.tag }}
tags: ${{ steps.lakefs_meta.outputs.tags }}
- name: lakectl docker metadata
id: lakectl_meta
uses: docker/metadata-action@v5
with:
images: |
treeverse/lakectl
${{ steps.login-ecr.outputs.registry }}/lakectl
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.tag }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.tag }}
type=semver,pattern={{major}},value=${{ steps.version.outputs.tag }}
- name: Build and push lakectl
uses: docker/build-push-action@v5
with:
context: .
target: lakectl
push: true
platforms: linux/amd64,linux/arm64
build-args: VERSION=${{ steps.version.outputs.tag }}
tags: ${{ steps.lakectl_meta.outputs.tags }}