name: compute

on:
  push:
    branches:
      - master
  workflow_dispatch:

jobs:
  deploy:
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v4

      - name: Write env file
        run: |
          test -n "${{ secrets.ENV_COMPUTE }}"
          umask 077
          printf '%s\n' "${{ secrets.ENV_COMPUTE }}" > .env.production

      - name: Deploy compute frontend
        run: docker compose -f docker-compose.compute.yml up -d --build --remove-orphans
