From 9290cd8771342cb49ae2277670b8e418a578ff40 Mon Sep 17 00:00:00 2001 From: Lyn Fugmann Date: Sun, 6 Oct 2024 23:06:29 +0200 Subject: [PATCH] auto deploy --- .forgejo/workflows/publish.yaml | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.forgejo/workflows/publish.yaml b/.forgejo/workflows/publish.yaml index a971b9b..f298d86 100644 --- a/.forgejo/workflows/publish.yaml +++ b/.forgejo/workflows/publish.yaml @@ -8,16 +8,16 @@ on: jobs: publish: runs-on: ubuntu-latest - # env: - # SSH_PRIVATE_KEY: ${{ secrets.SOME_SECRET_THAT_REPRESENTS_THE_PRIVATE_KEY }} + env: + SSH_PRIVATE_KEY: ${{ secrets.SSH_DEPLOY_PRIVATE_KEY }} steps: - - run: apt update && apt install dnsutils -y && dig git.ifsr.de - - - uses: actions/checkout@v4 + - name: checkout + uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v4 + - name: setup node + uses: actions/setup-node@v4 with: node-version: 'lts/*' @@ -25,15 +25,18 @@ jobs: - run: npm run build - - uses: https://code.forgejo.org/forgejo/upload-artifact@v4 + - name: upload artifact + uses: https://code.forgejo.org/forgejo/upload-artifact@v4 with: path: _site - # - name: Deploy - # run: | - # eval $(ssh-agent -s) - # echo "$SSH_PRIVATE_KEY" | ssh-add - - # apt update && apt install -y rsync - # mkdir ~/.ssh - # ssh-keyscan your-host.com > ~/.ssh/known_hosts - # rsync -atv --progress ./public/ your-user@your-host.com:/home/your-user/your-content-directory/public + - name: deploy + run: | + apt-get update && apt-get install -y rsync + wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq + eval $(ssh-agent -s) + echo "$SSH_PRIVATE_KEY" | ssh-add - + mkdir ~/.ssh + ssh-keyscan ifsr.de > ~/.ssh/known_hosts + year=$(yq '.year' content/_data/ese.yaml) + rsync -rvh --progress --delete --chmod=ugo=rwX _site/ ese-deploy@ifsr.de:"$year"