-
Notifications
You must be signed in to change notification settings - Fork 2k
90 lines (77 loc) · 2.59 KB
/
pushdocker.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
# When tagging a release, do two things
# 1.
name: Push To Docker
# Workflow's trigger
on:
release:
types: [ published ]
# Workflow's jobs
jobs:
docker:
strategy:
matrix:
include:
- arch: amd64
- arch: arm64
variant: v8
runs-on: ubuntu-latest
steps:
- name: Check out git repository
uses: actions/checkout@main
# Unable to obtain version number. Since the workflow doesn't support it, we'll use a plugin
- name: Create version
id: chat2db_version
uses: bhowell2/[email protected]
with:
value: ${{ github.ref }}
index_of_str: "refs/tags/v"
# Outputting basic information
- name: Print basic information
run: |
echo "current version: ${{ steps.chat2db_version.outputs.substring }}"
# Install Node.js
- name: Install Node.js
uses: actions/setup-node@main
with:
node-version: 16
cache: "yarn"
cache-dependency-path: chat2db-client/yarn.lock
# Build static file information
- name: Yarn install & build & copy
run: |
cd chat2db-client
yarn install
yarn run build:web:prod --app_version=${{ steps.chat2db_version.outputs.substring }}
cp -r dist ../chat2db-server/chat2db-server-web-start/src/main/resources/static/front
cp -r dist/index.html ../chat2db-server/chat2db-server-web-start/src/main/resources/thymeleaf/
# Install java and maven
- name: Install Java and Maven
uses: actions/setup-java@main
with:
java-version: "17"
distribution: "adopt"
cache: "maven"
# Compile server-side Java version
- name: Build Java
run: mvn clean package -B '-Dmaven.test.skip=true' -f chat2db-server/pom.xml
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: amd64,arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Log in docker hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Packaging and sending to Docker
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64,linux/arm64/v8
tags: chat2db/chat2db:${{ steps.chat2db_version.outputs.substring }},chat2db/chat2db:latest
file: docker/Dockerfile