Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e1d85a6243
|
|||
|
e6d985b364
|
|||
|
2eaf7b8d5d
|
|||
|
626b7f1984
|
|||
|
0cf142fc51
|
24
.gitea/workflows/test.yml
Normal file
24
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
name: Test upload web docs
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Create example content
|
||||||
|
run: |
|
||||||
|
mkdir -p web
|
||||||
|
echo "<h1>Works</h1><a href="other.html">Link to other page</a>" > web/index.html
|
||||||
|
echo "<h1>Works again</h1>" > web/other.html
|
||||||
|
|
||||||
|
- name: Upload web docs
|
||||||
|
uses: https://git.pvv.ntnu.no/Projects/rsync-action@${{ gitea.ref_name }}
|
||||||
|
with:
|
||||||
|
source: web
|
||||||
|
target: ${{ gitea.ref_name }}
|
||||||
|
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"
|
||||||
4
LICENSE
4
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2024 h7x4
|
Copyright (c) 2025 Programvareverkstedet
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -23,7 +23,8 @@ Advanced usage:
|
|||||||
- name: Transfer files
|
- name: Transfer files
|
||||||
uses: https://git.pvv.ntnu.no/Projects/rsync-action@v1
|
uses: https://git.pvv.ntnu.no/Projects/rsync-action@v1
|
||||||
with:
|
with:
|
||||||
source: ./path/to/directory/
|
source: ./path/to/directory/**/*
|
||||||
|
quote-source: false
|
||||||
target: /path/at/remote/
|
target: /path/at/remote/
|
||||||
username: username
|
username: username
|
||||||
host: hostname
|
host: hostname
|
||||||
@@ -45,4 +46,21 @@ command="rrsync -wo /directory/to/write/to",restrict,no-agent-forwarding,no-port
|
|||||||
|
|
||||||
The path specified in `target` will now be relative to `/directory/to/write/to`.
|
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`](https://git.pvv.ntnu.no/Projects)
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- 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"
|
||||||
|
```
|
||||||
|
|
||||||
[rsync]: https://rsync.samba.org/
|
[rsync]: https://rsync.samba.org/
|
||||||
|
|||||||
12
action.yml
12
action.yml
@@ -20,6 +20,10 @@ inputs:
|
|||||||
source:
|
source:
|
||||||
description: "Which files to copy"
|
description: "Which files to copy"
|
||||||
required: true
|
required: true
|
||||||
|
quote-source:
|
||||||
|
description: "Whether to quote the source string"
|
||||||
|
required: true
|
||||||
|
default: 'true'
|
||||||
target:
|
target:
|
||||||
description: "Where on the host to copy the files"
|
description: "Where on the host to copy the files"
|
||||||
required: true
|
required: true
|
||||||
@@ -98,11 +102,15 @@ runs:
|
|||||||
- name: Transfer files
|
- name: Transfer files
|
||||||
run: |
|
run: |
|
||||||
echo "Transferring files"
|
echo "Transferring files"
|
||||||
rsync ${{ inputs.args }} "${{ inputs.source }}" "targethost:${{ inputs.target }}"
|
if [ "${{ inputs.quote-source }}" = "true" ]; then
|
||||||
|
rsync ${{ inputs.args }} "${{ inputs.source }}" "targethost:${{ inputs.target }}"
|
||||||
|
else
|
||||||
|
rsync ${{ inputs.args }} ${{ inputs.source }} "targethost:${{ inputs.target }}"
|
||||||
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
run: |
|
run: |
|
||||||
echo "Cleaning up"
|
echo "Cleaning up"
|
||||||
rm -f ~/.ssh/{config,key,known_hosts} || true
|
rm -f ~/.ssh/{config,key,known_hosts} || true
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
Reference in New Issue
Block a user