Add Dockerfile and build image flow #19
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
name: Stable Release | |
on: | |
workflow_dispatch: | |
inputs: | |
specific_version: | |
type: string | |
description: Specific version number (Optional). Default will be the current version plus 0.0.1. | |
pull_request: | |
types: [labeled] | |
jobs: | |
stable-release-wren-engine: | |
if: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GHCR_TOKEN }} | |
- name: Set up Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "stable-release-bot" | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'maven' | |
- name: Maven Prepare Release | |
id: maven_prepare_release | |
run: | | |
if [ -n "${{ github.event.inputs.specific_version }}" ]; then | |
version_number=${{ github.event.inputs.specific_version }} | |
./mvnw release:prepare -B -DreleaseVersion=${{ github.event.inputs.specific_version }} | |
else | |
version_number=$(./mvnw --quiet help:evaluate -Dexpression=project.version -DforceStdout | sed -n 's/^\(.*\)-SNAPSHOT/\1/p') | |
./mvnw release:prepare -B -DreleaseVersion=${version_number} | |
fi | |
git push | |
git push origin $version_number | |
echo "version_number=$version_number" >> $GITHUB_OUTPUT | |
- name: Build | |
run: | | |
./mvnw clean install -B -DskipTests -P exec-jar | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USERNAME }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
run: | | |
WREN_VERSION=$(./mvnw --quiet help:evaluate -Dexpression=project.version -DforceStdout) | |
cd ./docker | |
cp ../wren-server/target/wren-server-${WREN_VERSION}-executable.jar ./ | |
cp -r ../wren-sqlglot-server/ ./ | |
docker buildx build \ | |
--platform linux/amd64,linux/arm64 \ | |
--tag ghcr.io/canner/wren-engine:${{ steps.maven_prepare_release.outputs.version_number }} \ | |
--tag ghcr.io/canner/wren-engine:latest \ | |
--push -f ./Dockerfile \ | |
--build-arg "WREN_VERSION=${WREN_VERSION}" . | |
prepare-ibis-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GHCR_TOKEN }} | |
- name: Set up Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "stable-release-bot" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version-file: ./ibis-server/pyproject.toml | |
- uses: abatilo/actions-poetry@v3 | |
with: | |
poetry-version: 1.7.1 | |
- name: Prepare next version | |
id: next_version | |
run: | | |
if [ -n "${{ github.event.inputs.specific_version }}" ]; then | |
version=${{ github.event.inputs.specific_version }} | |
else | |
version=$(grep -m 1 version ./ibis-server/pyproject.toml | grep -e '\d.\d.\d' -o) | |
IFS=. read major minor micro <<< "${version}" | |
micro=$((micro + 1)) | |
version=$major.$minor.$micro | |
fi | |
poetry version --next-phase $version | |
git add ./ibis-server/pyproject.toml | |
git commit -m "Upgrade ibis version to $version" | |
git push | |
echo "value=$version" >> $GITHUB_OUTPUT | |
outputs: | |
next_version: ${{ steps.next_version.outputs.value }} | |
stable-release-ibis: | |
needs: prepare-ibis-version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/canner/wren-engine-ibis | |
tags: | | |
type=raw,value=${{ needs.prepare-ibis-version.outputs.next_version }} | |
type=raw,value=latest | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ibis-server | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} |