From 10fa1da740b76b5c5a2a3aac0b0b9ede1a9d0ef7 Mon Sep 17 00:00:00 2001 From: Jafner <40403594+Jafner@users.noreply.github.com> Date: Wed, 29 Sep 2021 11:33:13 -0700 Subject: [PATCH] Create CD Action --- .github/workflows/cd.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..26fbdd1 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,39 @@ +# This is a basic workflow to help you get started with Actions + +name: CD + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + #push: + # branches: [ main ] + #pull_request: + # branches: [ main ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + deploy update to server: + name: Deploy to server + runs-on: ubuntu-latest + steps: + - name: Updating and restarting service on host via SSH + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SITE_HOST }} + username: ${{ secrets.SITE_USERNAME }} + key: ${{ secrets.SITE_KEY }} + port: ${{ secrets.SITE_PORT }} + image: jafner/5etools-docker:latest + script: | + cd /root + docker pull $IMAGE + docker-compose down + docker-compose up -d + + - name: Sending Discord notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@master \ No newline at end of file