3.1.22 #56
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |