Deploy Auth Server #78
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: Deploy Auth Server | |
on: | |
workflow_dispatch | |
env: | |
REGISTRY: ghcr.io | |
CHANNEL: latest | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: auth | |
url: https://auth.rollycubes.com | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: cp schema.json auth/schema.json | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: auth | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-auth:${{ env.CHANNEL }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.DO_SSH_KEY }} | |
known_hosts: ${{ secrets.DO_KNOWN_HOSTS }} | |
- run: "ssh -p 22222 root@${{ secrets.DO_SERVER_IP }} mkdir -p /root/auth" | |
- run: "scp -P 22222 auth/docker-compose.yml root@${{ secrets.DO_SERVER_IP }}:/root/auth/." | |
- run: "ssh -p 22222 root@${{ secrets.DO_SERVER_IP }} bash -c \"'docker-compose -f auth/docker-compose.yml pull && docker-compose -f auth/docker-compose.yml --env-file secrets/.env up -d'\"" |