h7x4 e1d85a6243
All checks were successful
Test upload web docs / test (push) Successful in 45s
README: add PVV-specific example usage
2025-12-13 16:17:03 +09:00
2025-12-13 16:16:49 +09:00
2025-03-17 16:30:04 +01:00

Rsync action

This action sends the contents of a directory to a remote server using rsync.

Usage

Basic usage:

- name: Transfer files
  uses: https://git.pvv.ntnu.no/Projects/rsync-action@v1
  with:
    source: ./path/to/directory/
    target: /path/at/remote/
    username: username
    host: hostname
    ssh-key: ${{ secrets.SSH_KEY }}

Advanced usage:

- name: Transfer files
  uses: https://git.pvv.ntnu.no/Projects/rsync-action@v1
  with:
    source: ./path/to/directory/**/*
    quote-source: false
    target: /path/at/remote/
    username: username
    host: hostname
    port: 2222
    ssh-key: ${{ secrets.SSH_KEY }}
    args: -avz --mkpath --exclude 'node_modules' --delete
    known-hosts: "[hostname]:2222 ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

To force the action to only write to a specific directory, and to prevent excessive damage should the SSH key be compromised, it is recommended to force the command in the authorized_keys file.

command="rrsync -wo /directory/to/write/to",restrict,no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

The path specified in target will now be relative to /directory/to/write/to.

PVV setup against pages.pvv.ntnu.no

You can copy paste this for use in pipeline for Projects

- name: Upload HTML page
  uses: https://git.pvv.ntnu.no/Projects/rsync-action@v2
  with:
    source: ./result/**/*.html
    quote-source: false
    target: ${{ gitea.ref_name }}/stuff/${{ github.run_id }}/
    username: gitea-web
    ssh-key: ${{ secrets.WEB_SYNC_SSH_KEY }}
    host: pages.pvv.ntnu.no
    known-hosts: "pages.pvv.ntnu.no ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH2QjfFB+city1SYqltkVqWACfo1j37k+oQQfj13mtgg"
2025-12-13 08:19:22 +01:00