Deploy Bot #52
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 Bot | |
# Only runs after PRs have been merged into master | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
deploy: | |
name: Deploy Bot | |
runs-on: 'ubuntu-latest' | |
environment: production | |
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' | |
steps: | |
- name: SSH Remote Commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: cd /srv/crowbartools-discord-bot/ && git reset --hard origin/master && git pull && npm install && npm run build && pm2 restart discord-bot | |
- name: Discord Webhook Action | |
uses: tsickert/[email protected] | |
if: ${{ success() }} | |
with: | |
webhook-url: ${{ secrets.DISCORD_GIT_WEBHOOK_URL }} | |
embed-title: "[crowbartools/crowbartools-discord-bot] Deployed to Production" | |
embed-url: "https://github.com/crowbartools/crowbartools-discord-bot/deployments" | |
embed-color: 5763719 | |
- name: Discord Webhook Action | |
uses: tsickert/[email protected] | |
if: ${{ failure() }} | |
with: | |
webhook-url: ${{ secrets.DISCORD_GIT_WEBHOOK_URL }} | |
embed-title: "[crowbartools/crowbartools-discord-bot] Deployment Failed" | |
embed-url: "https://github.com/crowbartools/crowbartools-discord-bot/deployments" | |
embed-color: 15548997 |