diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 15b861f..f9286ec 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -7,6 +7,8 @@ on: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.actor }}/koj-client:latest + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} jobs: publish: @@ -34,7 +36,14 @@ jobs: 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 -p ${{secrets.SSH_PORT}} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ secrets.WORK_DIR }} && docker compose pull && docker compose up -d && exit" + - name: connect, login, and pull + run: | + ssh -p ${{secrets.SSH_PORT}} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} " + cd ${{ secrets.WORK_DIR }} + echo $DOCKER_PASSWORD | docker login ghcr.io -u $DOCKER_USERNAME --password-stdin + docker compose pull + docker compose up -d + exit + " - name: cleanup run: rm -rf ~/.ssh