Skip to content

Clean code

Clean code #73

Workflow file for this run

name: To registry, pull and up
on:
workflow_dispatch:
pull_request:
push:
branches:
- preprod
jobs:
build:
name: Build, push, pull & up
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Replace API Key
env:
API: ${{ secrets.API_KEY }}
run: sed -i -e "s/secret.API_KEY/$API/" assets/js/main.js
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: registry.realt.community/stats-realt:${{ github.ref_name }}
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key
cat >>~/.ssh/config <<END
Host staging
HostName $SSH_HOST
User $SSH_USER
Port $SSH_PORT
IdentityFile ~/.ssh/staging.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}
- name: pull & up!
run: ssh staging 'cd /home/realt/docker/RealT-Stats-Preprod && git pull && docker compose --file docker-compose-preprod.yml pull && docker compose --file docker-compose-preprod.yml up -d'