From 003ac943ea9f9a6525a8f0485dbfa7199114026b Mon Sep 17 00:00:00 2001 From: Marc Riera Date: Sat, 17 Feb 2024 13:48:09 +0100 Subject: [PATCH] Test --- .forgejo/workflows/build.yaml | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .forgejo/workflows/build.yaml diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..e997a22 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,55 @@ +name: publish + +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + env: + SSH_PRIVATE_KEY: ${{ secrets.PUBLISHER_PRIVATE_KEY }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 # all history for all branches and tags\ + + - uses: actions/cache@v3 + id: cache + with: + path: | + ~/.cache/go-build + ~/go + key: ${{ runner.os }}-go- + + - uses: actions/setup-go@v4 + with: + go-version: '>=1.21.0' + + - name: Install Hugo + run: | + go install -tags extended github.com/gohugoio/hugo@latest + + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Build + run: | + hugo --minify + + - 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 \ No newline at end of file