Skip to content

quick fix

quick fix #398

name: Deploy Images to GHCR
on:
push:
branches:
- alpha
- dev
- master
workflow_dispatch:
inputs:
version:
description: 'Images tag'
required: true
default: 'alpha'
permissions:
contents: write
pull-requests: write
packages: write
jobs:
run-tests:
uses: ./.github/workflows/unit_tests.yml
secrets:
PYKLATCHAT_TESTING_CREDENTIALS_V2: ${{ secrets.PYKLATCHAT_TESTING_CREDENTIALS_V2 }}
SERVER_ENV: ${{ secrets.SERVER_ENV }}
bump-dynamic-dependencies:
uses: ./.github/workflows/bump_dynamic_dependencies.yml
publish-images:
runs-on: ubuntu-latest
needs: [run-tests, bump-dynamic-dependencies]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
- 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
- name: Apply Workflow Run Environments
if: github.event_name == 'workflow_run'
run: |
echo "VERSION=$(echo ${{ github.ref_name }} | tr / -)" >> $GITHUB_ENV
- name: Apply Push Environments
if: github.event_name == 'push'
run: |
echo "VERSION=$(echo ${{ github.ref_name }} | tr / -)" >> $GITHUB_ENV
- 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