-
Notifications
You must be signed in to change notification settings - Fork 7
81 lines (71 loc) · 2.96 KB
/
docker-latest.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
# This job builds and deploys Docker image to DockerHub
name: DockerHub-deploy
on:
workflow_run:
workflows: ['CI Master branch'] # runs after CI workflow
types:
- completed
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v3 # checkout from Git
with:
ref: master # Always checks out the master branch (due to config file)
- name: Download a JAR file to deploy # download `evita-server.jar` artifact if the workflow we react to was successful
uses: dawidd6/action-download-artifact@v6
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: evita-server.jar
path: docker
- name: Download a version information # download `version.txt` artifact if the workflow we react to was successful
uses: dawidd6/action-download-artifact@v6
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
workflow_conclusion: success
name: version.txt
- name: Set up QEMU
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
platforms: linux/amd64,linux/arm64/v8
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ vars.CI_REGISTRY_USER }}
password: ${{ secrets.CI_REGISTRY_PASSWORD }}
- name: Extract major version
id: major_version
# create a new output variable with the major version (like 2024.4)
run: |
echo "fullVersion=$(cat version.txt)"
echo "fullVersion=$(cat version.txt)" >> $GITHUB_ENV
echo "version=$(cat version.txt | cut -d'.' -f1,2)"
echo "version=$(cat version.txt | cut -d'.' -f1,2)" >> $GITHUB_ENV
echo "releaseDate=$(date +%Y-%m-%d)" >> $GITHUB_ENV
- name: Build and push Docker image
env:
RELEASE_IMAGE: "evitadb:latest"
EVITA_JAR_NAME: evita-server.jar
uses: docker/build-push-action@v3
with:
context: ./docker
file: ./docker/Dockerfile
pull: true
push: true
# push the image with two tags: latest and the version from the version.txt file
tags: |
${{ vars.CI_REGISTRY_USER }}/${{ env.RELEASE_IMAGE }}
${{ vars.CI_REGISTRY_USER }}/evitadb:${{ env.version }}
${{ vars.CI_REGISTRY_USER }}/evitadb:${{ env.fullVersion }}
platforms: linux/amd64,linux/arm64/v8
build-args: |
EVITA_JAR_NAME=${{ env.EVITA_JAR_NAME }}
VERSION=${{ env.fullVersion }}
RELEASE_DATE=${{ env.releaseDate }}