Merge pull request #274 from Unity-Developer-Community/feat/more-misc… #59
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 to UDC Server | |
on: | |
push: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
push_to_registry: | |
name: Push Docker image to GitHub Packages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ghcr.io/unity-developer-community/udc-bot:latest | |
restart: | |
name: Restart Bot | |
needs: push_to_registry | |
runs-on: ubuntu-latest | |
environment: | |
name: prod | |
steps: | |
- name: Run commands in SSH | |
uses: appleboy/ssh-action@master | |
with: | |
script: | | |
cd ${{ secrets.SERVER_BUILD_DIR }} | |
docker-compose pull | |
docker-compose up -d | |
host: ${{ secrets.SERVER_IP }} | |
port: ${{ secrets.SERVER_PORT }} | |
username: ${{ secrets.SERVER_USER }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: Bot has been deployment to UDC Server successfully. |