Skip to content

Quotly Deploy Pipeline #11

Quotly Deploy Pipeline

Quotly Deploy Pipeline #11

Workflow file for this run

name: Quotly Deploy Pipeline
on:
workflow_dispatch:
inputs:
package_registry:
description: 'Select the package registry to deploy from (staging or release)'
required: true
default: 'quotly-release'
type: choice
options:
- quotly-release
- quotly-staging
image_tag:
description: 'Enter the image tag to deploy (e.g., staging: <branch-name>.<build-num> or release: YYYY.MM.<build-num>)'
required: true
type: string
permissions: read-all
jobs:
deploy:
runs-on: self-hosted
environment: default
steps:
- name: Set variables
id: vars
run: |
echo "IMAGE_NAME=ghcr.io/quotly-eu/${{ github.event.inputs.package_registry }}:${{ github.event.inputs.image_tag }}" >> $GITHUB_ENV
- name: Login to Github Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.QUOTLY_TOKEN }}
- name: Deploy Docker image
run: |
docker pull ${{ env.IMAGE_NAME }}
docker stop quotly_backend || true
docker rm quotly_backend || true
docker run -d \
--name quotly_backend \
--restart unless-stopped \
-p 8010:${{ vars.SERVER_PORT }} \
-e SERVER_HOST=${{ vars.SERVER_HOST }} \
-e SERVER_PORT=${{ vars.SERVER_PORT }} \
-e DATABASE_URL=${{ vars.DATABASE_URL }} \
-e DATABASE_USERNAME=${{ vars.DATABASE_USERNAME }} \
-e DATABASE_PASSWORD=${{ secrets.DATABASE_PASSWORD }} \
${{ env.IMAGE_NAME }}
docker image prune -f