forked from treeverse/lakeFS
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (75 loc) · 3.15 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
name: Docker
on:
release:
types: [published]
# 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-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: '16.15.0'
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.17.8
id: go
- name: Generate code
run: make gen
- 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@v1
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
- name: Extract version
shell: bash
run: echo "::set-output name=tag::$(echo ${GITHUB_REF##*/} | sed s/^v//g)"
id: version
- name: Extract db schema version from ddl migration files
run: echo "::set-output name=dbschema_version::$( (cd pkg/ddl/ && ls -d *.up.sql) | sed -nE '$s/^0*([0-9]+).*/\1/p' )"
id: schema
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build and push to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY_LAKEFS: lakefs
ECR_REPOSITORY_LAKECTL: lakectl
run: |
docker build --target lakectl -t $ECR_REGISTRY/$ECR_REPOSITORY_LAKECTL:${{ steps.version.outputs.tag }} --build-arg VERSION=${{ steps.version.outputs.tag }} --label db-schema-version=${{ steps.schema.outputs.dbschema_version}} .
docker push $ECR_REGISTRY/$ECR_REPOSITORY_LAKECTL:${{ steps.version.outputs.tag }}
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY_LAKEFS:${{ steps.version.outputs.tag }} --build-arg VERSION=${{ steps.version.outputs.tag }} --label db-schema-version=${{ steps.schema.outputs.dbschema_version}} .
docker push $ECR_REGISTRY/$ECR_REPOSITORY_LAKEFS:${{ steps.version.outputs.tag }}
- name: Build and push lakectl to Docker hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
build_args: VERSION=${{ steps.version.outputs.tag }}
labels: db-schema-version=${{ steps.schema.outputs.dbschema_version}}
target: lakectl
repository: treeverse/lakectl
tags: ${{ steps.version.outputs.tag }},latest
- name: Build and push lakefs to Docker hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
build_args: VERSION=${{ steps.version.outputs.tag }}
labels: db-schema-version=${{ steps.schema.outputs.dbschema_version}}
target: lakefs
repository: treeverse/lakefs
tags: ${{ steps.version.outputs.tag }},latest