This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (94 loc) · 3.1 KB
/
docker.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Docker Release
on:
workflow_call:
inputs:
publish:
required: false
default: false
type: boolean
cryptobox_image:
required: true
type: string
runtime_image:
required: true
type: string
platforms:
required: true
type: string
secrets:
docker_password:
required: true
webhook:
required: true
jobs:
docker_release:
name: Release Docker Cryptobox & Runtime
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Set Release Version
# use the version specified in the pom.xml as the tag
run: |
export MVN_VERSION=$(mvn -q \
-Dexec.executable=echo \
-Dexec.args='${project.version}' \
--non-recursive \
exec:exec)
echo "RELEASE_VERSION=${MVN_VERSION}" >> $GITHUB_ENV
# extract metadata for labels https://github.com/docker/metadata-action
- name: Docker meta Cryptobox
id: meta_cryptobox
uses: docker/metadata-action@v4
with:
images: ${{ inputs.cryptobox_image }}
# extract metadata for labels https://github.com/docker/metadata-action
- name: Docker meta Runtime
id: meta_runtime
uses: docker/metadata-action@v4
with:
images: ${{ inputs.runtime_image }}
# setup docker actions https://github.com/docker/build-push-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
if: ${{ inputs.publish }}
with:
username: wirebot
password: ${{ secrets.docker_password }}
- name: Build Cryptobox
uses: docker/build-push-action@v4
with:
file: dockerfiles/Dockerfile
context: .
target: cryptobox
tags: ${{ inputs.cryptobox_image }}:latest, ${{ inputs.cryptobox_image }}:${{ env.RELEASE_VERSION }}
labels: ${{ steps.meta_cryptobox.outputs.labels }}
platforms: ${{ inputs.platforms }}
push: ${{ inputs.publish }}
- name: Build Runtime
uses: docker/build-push-action@v4
with:
file: dockerfiles/Dockerfile
context: .
target: runtime
tags: ${{ inputs.runtime_image }}:latest, ${{ inputs.runtime_image }}:${{ env.RELEASE_VERSION }}
labels: ${{ steps.meta_runtime.outputs.labels }}
platforms: ${{ inputs.platforms }}
push: ${{ inputs.publish }}
# Send webhook to Wire using Slack Bot
- name: Webhook to Wire
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: Cryptobox4j - Wire Bot Runtime Docker Release Platform ${{ inputs.platform }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.webhook }}
if: failure()