Skip to content

Merge pull request #7 from ginruh/dev #7

Merge pull request #7 from ginruh/dev

Merge pull request #7 from ginruh/dev #7

Workflow file for this run

name: Create and publish images
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create .env file
run: |
echo "POSTGRES_URI=${{ secrets.APP_POSTGRES_URI }}" > .env
- name: Build and push listener image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: src/listener/Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/listener:latest
- name: Setup ssh key
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.ACTION_PRIVATE_KEY }}" > ~/.ssh/github_action.key
sudo chmod 600 ~/.ssh/github_action.key
ssh-keyscan -H ${{ secrets.SERVER_IP }} > ~/.ssh/known_hosts
- name: Deploy
run: |
ssh ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }} -i ~/.ssh/github_action.key /bin/bash << EOF
cd ${{ secrets.REPO_PATH }};
git pull origin master;
docker compose down;
docker compose pull;
docker compose up -d;
EOF