This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
feat : ProblemAddModal #21
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 | |
on: | |
push: | |
branches: ["main"] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.actor }}/koj-client: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 | |
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 | |
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 -p ${{secrets.SSH_PORT}} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ secrets.WORK_DIR }} && docker compose pull && docker compose up -d && exit" | |
- name: cleanup | |
run: rm -rf ~/.ssh |