49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
name: Deploy service MASTER
|
|
|
|
on:
|
|
push:
|
|
# TODO: if someone tags 'prod' to a (broken) feature branch
|
|
# this still triggers (and deploys to prod).
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'prod'
|
|
- 'v*'
|
|
# paths:
|
|
# - 'services/000-master/**'
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: hla-dev
|
|
defaults:
|
|
run:
|
|
working-directory: ./services
|
|
|
|
env:
|
|
# commit tagged ? yes->prod : no->dev
|
|
AGEBD_ENV: ${{ github.ref_type == 'tag' && 'prod' || 'dev' }}
|
|
SVC_CURRRENT_DIR: /sls/bd/hla/${{ github.ref_type == 'tag' && 'prod' || 'dev' }}/services/000-master/current
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Copy files and replace {{ agebd_env }} with dev or prod
|
|
run: |
|
|
mkdir -p ${SVC_CURRRENT_DIR}
|
|
cp -r 000-master/* ${SVC_CURRRENT_DIR}
|
|
sed -i 's/{{ agebd_env }}/dev/g' ${SVC_CURRRENT_DIR}/systemd/AGEBD-SERVICE-MASTER.service
|
|
|
|
- name: Create Python venv
|
|
run: |
|
|
cd ${SVC_CURRRENT_DIR}/app
|
|
uv venv --allow-existing --system-site-packages .venv
|
|
uv sync
|
|
|
|
- name: Restart Service
|
|
run: |
|
|
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable --force ${SVC_CURRRENT_DIR}/systemd/AGEBD-SERVICE-MASTER.service
|
|
systemctl --user restart AGEBD-SERVICE-MASTER.service
|