Skip to content

Support for admin api #283

Support for admin api

Support for admin api #283

name: Deploy Images to GHCR
on:
push:
branches:
- dev
- main
pull_request:
workflow_dispatch:
inputs:
version:
description: 'Images tag'
required: true
default: 'dev'
# images:
# description: 'Include Images (klatchat_observer|chat_client|chat_server) space-separated'
# required: false
# default: klatchat_observer chat_client chat_server
permissions:
contents: write
pull-requests: write
packages: write
jobs:
publish-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node JS
run: |
sudo apt-get update && sudo apt-get install nodejs && sudo apt-get install npm
- name: Build minified js files
run: |
cd scripts && python minifier.py --working_dir ../chat_client/static/js --processing_pattern .*\.js$ --skipping_pattern .*\.min\.js$ --skip_dirs build
- name: Build minified css files
run: |
cd scripts && python minifier.py --working_dir ../chat_client/static/css --processing_pattern .*\.css$ --skipping_pattern .*\.min\.css$ --skip_dirs build
- name: Authorize Github Token
run: |
echo $GITHUB_TOKEN | docker login ghcr.io -u neongeckocom --password-stdin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Version
id: version
run: |
VERSION=$(sed "s/a/-a./" <<< $(python setup.py --version))
echo ::set-output name=version::${VERSION}
- name: Build Base Image
run: |
cd scripts && bash build_base_image.sh -v ${{ steps.version.outputs.version }}
- name: Build Pyklatchat Images
run: |
cd scripts && bash build_pyklatchat_images.sh -v ${{ steps.version.outputs.version }}
- name: Apply Workflow Dispatch Environments
if: github.event_name == 'workflow_dispatch'
run: |
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
# echo ${{ github.event.inputs.images }} >> $IMAGES
- name: Apply Pull Request Environments
if: github.event_name == 'pull_request'
run: |
echo "VERSION=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
# echo klatchat_observer chat_client chat_server >> $IMAGES
- name: Apply Push Environments
if: github.event_name == 'push'
run: |
echo "VERSION=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
# echo klatchat_observer chat_client chat_server >> $IMAGES
- name: Clean Up Version
run: |
echo "VERSION=${VERSION//['/']/-}" >> $GITHUB_ENV
- name: Push Images
run: |
for IMAGE in $IMAGES; do
docker image push ghcr.io/neongeckocom/$IMAGE:${{ steps.version.outputs.version }}
if [ -n "$VERSION" ]; then
docker tag ghcr.io/neongeckocom/$IMAGE:${{ steps.version.outputs.version }} ghcr.io/neongeckocom/$IMAGE:$VERSION
docker image push ghcr.io/neongeckocom/$IMAGE:$VERSION
fi
done
env:
VERSION: ${{ env.VERSION }}
IMAGES: pyklatchat_base klatchat_observer chat_client chat_server