Skip to content

Deploy Prod configuration #19

Deploy Prod configuration

Deploy Prod configuration #19

name: Deploy Prod configuration
on:
workflow_run:
workflows: ["Create and publish a Docker image"]
types: [completed]
branches:
- 'main'
- 'v*'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to SSH target
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.ACCESS_KEY }}
script: |
temp_env_file=$(mktemp)
echo """${{secrets.COMPOSE_ENV}}""" >> $temp_env_file
echo "ENV_PATH=$temp_env_file" >> $temp_env_file
if [ ! -d socialpredict-deploy ]
then
git clone ${{ github.server_url }}/${{ github.repository }} socialpredict-deploy
cd socialpredict-deploy
else
cd socialpredict-deploy
git fetch origin
fi
template="./frontend/src/config.js.template"
file="./frontend/src/config.js"
export API_DOMAIN="'https://${DOMAIN}'"
envsubst < $template > $file
git checkout ${{ github.sha }}
echo "${{ secrets.DOCKER_TOKEN }}" | docker login ghcr.io -u j4qfrost --password-stdin
docker compose -f ./scripts/docker-compose-prod.yaml \
--env-file $temp_env_file \
up -d
lighthouse:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Audit URLs using Lighthouse
uses: treosh/lighthouse-ci-action@v12
with:
urls: |
https://openprediction.xyz/
budgetPath: ./scripts/lighthouse # test performance budgets
uploadArtifacts: true # save results as an action artifacts
temporaryPublicStorage: true # upload lighthouse report to the temporary storage