Skip to content

Small Fixes

Small Fixes #49

name: publish
on:
push:
branches: ["master"]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.actor }}/library-mvc:latest
jobs:
publish:
name: publish image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login
run: |
echo ${{ secrets.PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and Publish Backend
run: |
docker build . --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# deploy:
# needs: publish
# name: deploy image
# runs-on: ubuntu-latest
#
# steps:
# - name: install ssh keys
# # check this thread to understand why its needed:
# # <https://stackoverflow.com/a/70447517>
# run: |
# install -m 600 -D /dev/null ~/.ssh/id_rsa
# echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
# ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
# - name: connect and pull
# run: ssh -T -vvv -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ secrets.WORK_DIR }} && sh -c ./pre-up.sh && docker-compose up -d && exit"
# - name: cleanup
# run: rm -rf ~/.ssh