chatbot-0.2 #43
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: Build library package on release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
build_library: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Grant execute permission for Gradlew | |
run: chmod +x gradlew | |
- name: Extract release information | |
id: extract_info | |
run: | | |
RELEASE_NAME=${{ github.event.release.name }} | |
echo $RELEASE_NAME | |
if [[ "$RELEASE_NAME" == converter-* ]]; then | |
PROJECT="converter" | |
VERSION=${RELEASE_NAME#converter-} | |
elif [[ "$RELEASE_NAME" == chatbot-* ]]; then | |
PROJECT="chatbot" | |
VERSION=${RELEASE_NAME#chatbot-} | |
else | |
PROJECT="library" | |
VERSION=$RELEASE_NAME | |
fi | |
PATTERN="^([0-9]+\.[0-9]+(\.[0-9]+)?)(-[A-Za-z0-9\.]+)*$" | |
if [[ ! "$VERSION" =~ $PATTERN ]]; then | |
echo "Invalid version number" | |
exit 1 | |
fi | |
echo "::set-output name=project::$PROJECT" | |
echo "::set-output name=version::$VERSION" | |
- name: Build, run tests and publish library | |
if: steps.extract_info.outputs.project == 'library' | |
env: | |
GITHUB_ACTOR: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./gradlew -Pversion=${{ steps.extract_info.outputs.version }} publish | |
- name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push converter service Docker image | |
if: steps.extract_info.outputs.project == 'converter' | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
platforms: linux/amd64 | |
tags: ghcr.io/${{ github.repository_owner }}/hub-converter:${{ steps.extract_info.outputs.version }} | |
context: ./converter | |
- name: Build and push chatbot Docker image | |
if: steps.extract_info.outputs.project == 'chatbot' | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
platforms: linux/amd64 | |
tags: ghcr.io/${{ github.repository_owner }}/hub-chatbot:${{ steps.extract_info.outputs.version }} | |
context: ./chatbot |