Merge pull request #111 from Mirasaki/dev #53
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
notify-start: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Discord Webhook - Notify Start Deploy | |
uses: tsickert/[email protected] | |
continue-on-error: true | |
with: | |
webhook-url: ${{ secrets.DEPLOYMENT_WEBHOOK_URL }} | |
embed-author-name: "⬇️ CFTools Discord Bot" | |
embed-color: 14228765 | |
embed-description: "⌛ Deploying **`@${{ github.repository }}`**...\n📤 <@975340966342955038> is now temporarily unavailable." | |
deploy: | |
needs: notify-start | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Deploy to Production | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
passphrase: ${{ secrets.SSH_PASSPHRASE }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
cd ~/node/discord/cftools-discord-bot | |
pm2 stop cftools-discord-bot | |
git pull origin main | |
npm ci | |
pm2 restart cftools-discord-bot | |
notify-finish: | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Discord Webhook - Notify Finish Deploy | |
uses: tsickert/[email protected] | |
with: | |
webhook-url: ${{ secrets.DEPLOYMENT_WEBHOOK_URL }} | |
embed-author-name: "⬆️ CFTools Discord Bot" | |
embed-color: 45317 | |
embed-description: "✅ Finished deploying **`@${{ github.repository }}`**\n📥 <@975340966342955038> is back online" |