prod #18
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: prod | |
on: | |
workflow_dispatch | |
jobs: | |
deploy: | |
environment: | |
name: prod | |
name: Build and deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.REGISTRY_ACTOR }} | |
password: ${{ secrets.REGISTRY_TOKEN }} | |
- name: Build and push image to GitHub Container Registry | |
run: | | |
docker build -f Dockerfile.hetzner . --tag ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt:latest | |
docker push ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt:latest | |
- name: Deploy | |
uses: appleboy/ssh-action@v1.0.2 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
cd /root/app | |
docker login --username ${{ secrets.REGISTRY_ACTOR }} --password ${{ secrets.REGISTRY_TOKEN }} ghcr.io | |
docker image pull ${{ secrets.REGISTRY_DOCKER_REGISTRY }}/cobalt:latest | |
docker compose up --no-build --pull never --detach cobalt |