Skip to content

2.1.0

2.1.0 #3

Workflow file for this run

name: Publish
on:
release:
types: [created]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
services:
mariadb:
image: mariadb:10.5
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping -p'root'" --health-interval=5s --health-timeout=2s --health-retries=3
env:
MYSQL_USER: testuser
MYSQL_PASSWORD: testpass
MYSQL_ROOT_PASSWORD: root
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize MariaDB
env:
MARIADB_PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
echo "Creating databases"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_18 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_03 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_01 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_07 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE cfe_00 CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE flow CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "CREATE DATABASE location CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_18.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_03.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_01.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_07.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on cfe_00.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on flow.* to testuser@'%' identified by 'testpass';"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "grant all privileges on location.* to testuser@'%' identified by 'testpass';"
echo "Flushing privileges"
mysql -u root -h127.0.0.1 -p'root' -P${MARIADB_PORT} <<< "flush privileges;"
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}
- name: Build war
run: mvn --batch-mode -Drevision=${{ github.event.release.tag_name }} -Dsha1= -Dchangelist= clean package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Attach war to release
uses: softprops/action-gh-release@v1
with:
files: |
target/cfe_18.war
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}