personalpage/.github/workflows/main.yml

22 lines
803 B
YAML
Raw Normal View History

2024-01-25 08:32:12 +07:00
on:
push:
branches:
- main
workflow_dispatch:
jobs:
2024-02-15 11:42:48 +07:00
format:
name: run pull to sync on target message
2024-01-25 08:32:12 +07:00
runs-on: ubuntu-latest
2024-02-16 10:47:55 +07:00
if: "contains(github.event.head_commit.message, 'Production')"
2024-01-25 08:32:12 +07:00
steps:
2024-02-15 11:28:16 +07:00
- name: cleanup first if any .ssh file before
run: rm -rf ~/.ssh
2024-01-25 08:32:12 +07:00
- name: install ssh keys
# check this thread to understand why its needed:
# https://stackoverflow.com/a/70447517
2024-02-15 11:29:51 +07:00
run: install -m 600 -D /dev/null ~/.ssh/id_rsa && echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa && ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
2024-01-25 08:59:43 +07:00
- name: connect and pull
2024-02-15 11:31:54 +07:00
run: ssh fikyb-ssh@103.241.205.253 "cd /home/fikyb-ssh/htdocs/personalpage && git checkout main && git pull && exit"
2024-01-25 08:59:43 +07:00
- name: cleanup
run: rm -rf ~/.ssh