Skip to content

Commit c36084c

Browse files
authored
Update main.yml
1 parent 5814a77 commit c36084c

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
1-
name: Upload file to remote server
2-
on: [push]
1+
name: Push to Site Repo
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
38
jobs:
4-
build:
5-
name: Build
9+
update-file:
610
runs-on: ubuntu-latest
11+
712
steps:
8-
- name: Upload file to remote server
9-
uses: appleboy/ssh-action@v1
10-
with:
11-
host: ${{ secrets.HOST }}
12-
username: ${{ secrets.USER }}
13-
password: ${{ secrets.PASSWORD }}
14-
port: ${{ secrets.PORT }}
15-
script: cd /var/www/dansl.net/pages && wget -O linux.md https://raw.githubusercontent.com/dansl/LinuxOS-Stuff/refs/heads/main/README.md && git commit -a -m "updated linux.md" && git push
13+
- name: Checkout current repo
14+
uses: actions/checkout@v3
15+
16+
- name: Update page to target repo
17+
run: |
18+
git clone https://x-access-token:${{ secrets.TARGET_REPO_PAT }}@github.com/dansl/dansl.github.io target-repo
19+
cp build/README.md target-repo/pages/linux.md
20+
21+
cd target-repo
22+
git config user.email "139961+dansl@users.noreply.github.com"
23+
git config user.name "dansl"
24+
25+
if ! git diff --quiet -- pages/linux.md; then
26+
git add pages/linux.md
27+
git commit -m "Update page from source repo"
28+
git push origin main
29+
else
30+
echo "No changes to commit."
31+
fi

0 commit comments

Comments
 (0)