Skip to content

publish docker image and prebuilt jar on release #1

publish docker image and prebuilt jar on release

publish docker image and prebuilt jar on release #1

# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: publish-on-release
run-name: publish docker image and prebuilt jar on release
on:
release:
types: [published]
branches: [main]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish docker image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn package jib:dockerBuild -DskipTests
docker tag bigquery-antipattern-recognition ghcr.io/googlecloudplatform/bigquery-antipattern-recognition:latest
docker push ghcr.io/googlecloudplatform/bigquery-antipattern-recognition:latest
RELEASE_VERSION=${GITHUB_REF#refs/*/}
JAR_FILENAME=$(ls ./bigquery-antipattern-recognition/target/ | grep 'bigquery-antipattern-recognition-[0-9.]*-jar-with-dependencies.jar')
cp ./bigquery-antipattern-recognition/target/${JAR_FILENAME} ./bigquery-antipattern-recognition/target/bigquery-antipattern-recognition.jar
gh release upload $RELEASE_VERSION ./bigquery-antipattern-recognition/target/bigquery-antipattern-recognition.jar