From 7c64f3ea04b99f750e75bc3c7e15baf64f64aa41 Mon Sep 17 00:00:00 2001 From: IkiWiki Date: Sun, 25 Aug 2024 20:41:42 -0400 Subject: [PATCH] forgejo-ci: copy main's push workflow to public branch when deploying --- .forgejo/workflows/pages.yaml | 1 + .forgejo/workflows/push.yaml | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .forgejo/workflows/push.yaml diff --git a/.forgejo/workflows/pages.yaml b/.forgejo/workflows/pages.yaml index 17bb291..3c750ba 100644 --- a/.forgejo/workflows/pages.yaml +++ b/.forgejo/workflows/pages.yaml @@ -25,6 +25,7 @@ jobs: run: ikiwiki --setup ikiwiki.setup - name: Website upload run: | + cp .forgejo/workflow/push.yaml public/.forgejo/workflow/. git log -1 --pretty=%B > commit.txt cd public date > generated.txt diff --git a/.forgejo/workflows/push.yaml b/.forgejo/workflows/push.yaml new file mode 100644 index 0000000..1b821fd --- /dev/null +++ b/.forgejo/workflows/push.yaml @@ -0,0 +1,27 @@ +on: + push: + branches: + - 'public' + +jobs: + deploy: + runs-on: x86_64 + container: alpine:latest + env: + GIT_SSH_COMMAND: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no + steps: + - name: Environment setup + run: | + apk add git nodejs openssh-client-common openssh-client-default + - name: Start ssh-agent + uses: https://github.com/webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.PAGES_PRIVKEY }} + - name: Repo pull + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Website upload + run: | + git remote set-url origin pages@ayakael.net:/var/lib/pages/ayakael.net + git push -f