Skip to content

Instantly share code, notes, and snippets.

@muradddd
Created October 5, 2021 13:37
Show Gist options
  • Save muradddd/70648489c0c47133a22a1ca82469ad7e to your computer and use it in GitHub Desktop.
Save muradddd/70648489c0c47133a22a1ca82469ad7e to your computer and use it in GitHub Desktop.
ci/cd
name: build
on:
push:
branches:
- bugfix
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js 14.17.0
uses: actions/setup-node@v2
with:
node-version: '14.17.0'
- name: Install dependencies
run: |
yarn
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd ~/${{ github.event.repository.name }} &&
git pull &&
docker-compose up -d --build
prune:
needs: [deploy]
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
docker system prune -f
TelegramNotification:
needs: [prune]
name: Telegram Notification
runs-on: ubuntu-latest
steps:
- uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
The ${{ github.event_name }} event triggered final step.
Commit mesage: "${{ github.event.head_commit.message }}"
.github/workflows/deploy.yml
HOST - server ip
USERNAME - root(meselen)
PASSWORD - server password
TELEGRAM_TO - chat id
TELEGRAM_TOKEN - bot tokeni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment