debug umami #150
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish and Deploy | |
on: | |
push: | |
branches: | |
- main | |
env: | |
SSH_USER: lhendrix | |
SSH_HOST: 51.68.188.78 | |
REGISTRY: ghcr.io | |
IMAGE_NAME: battmoteam/battmoapp:latest | |
WORKDIR: battmogui | |
jobs: | |
publish: | |
name: publish image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Login | |
run: echo ${{ secrets.PAT }} | docker login ghcr.io -u lorenah84 --password-stdin | |
- name: Build | |
run: | | |
docker compose -f docker-compose-deploy.yml build | |
- name: Publish | |
run: docker compose -f docker-compose-deploy.yml push | |
deploy: | |
name: Deploy image | |
runs-on: ubuntu-latest | |
needs: publish | |
steps: | |
- name: Checkout code # <-- This step ensures docker-compose-deploy.yml is available | |
uses: actions/checkout@v3 | |
- name: Install SSH keys | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_rsa | |
echo "${{ secrets.ACTIONS_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ env.SSH_HOST }} >> ~/.ssh/known_hosts | |
- name: Test SSH Connection | |
run: ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ env.SSH_USER }}@${{ env.SSH_HOST }} "echo SSH connection successful" | |
- name: Login to Registry | |
run: echo ${{ secrets.PAT }} | docker login ghcr.io -u lorenah84 --password-stdin | |
- name: Copy docker-compose-deploy file to the server | |
run: scp -P ${{ secrets.SSH_PORT }} docker-compose-deploy.yml ${{ env.SSH_USER }}@${{ env.SSH_HOST }}:${{ env.WORKDIR }} | |
- name: Pull and Run Containers with Deploy File | |
run: | | |
ssh -p ${{ secrets.SSH_PORT }} ${{ env.SSH_USER }}@${{ env.SSH_HOST }} "cd ${{ env.WORKDIR }} && \ | |
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} \ | |
HASH_SALT=${{ secrets.HASH_SALT }} \ | |
docker compose -f docker-compose-deploy.yml pull && \ | |
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} \ | |
HASH_SALT=${{ secrets.HASH_SALT }} \ | |
docker compose -f docker-compose-deploy.yml up -d" | |
- name: Cleanup | |
run: rm -rf ~/.ssh |