mirror of
https://github.com/Burnett01/rsync-deployments.git
synced 2026-09-20 13:45:23 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 23a557dceb | |||
| ea3f2b7314 | |||
| 469a77e7aa | |||
| 819cb701d2 | |||
| c269e19dd0 | |||
| c39ab06b30 | |||
| 9f59b515f6 | |||
| c5464e03ed | |||
| 0010c2adf6 | |||
| c6d9be15a7 | |||
| d75a44a646 | |||
| c47cfee594 | |||
| 7e62b51e32 | |||
| f8c929a1f4 | |||
| 6a989b68a1 | |||
| 6fa9b56771 | |||
| f5c5431bf6 | |||
| 20b1f5b4b8 | |||
| 1bbe8382e5 |
+3
-8
@@ -1,12 +1,7 @@
|
||||
FROM ubuntu:latest
|
||||
|
||||
# Update
|
||||
RUN apt-get update
|
||||
|
||||
# Install packages
|
||||
RUN apt-get -yq install rsync openssh-client
|
||||
FROM drinternet/rsync:1.0.1
|
||||
|
||||
# Copy entrypoint
|
||||
ADD entrypoint.sh /entrypoint.sh
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Contention
|
||||
Copyright (c) 2019 Burnett01
|
||||
Copyright (c) 2019-2020 Contention
|
||||
Copyright (c) 2019-2020 Burnett01
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# rsync deployments
|
||||
|
||||
Forked from [Contention/rsync-deployments](https://github.com/Contention/rsync-deployments)
|
||||
This GitHub Action deploys files in `GITHUB_WORKSPACE` to a remote folder via rsync over ssh.
|
||||
|
||||
Use this action in a CD workflow which leaves deployable code in `GITHUB_WORKSPACE`.
|
||||
|
||||
This GitHub Action deploys files in `GITHUB_WORKSPACE` to a folder on a server via rsync over ssh.
|
||||
|
||||
Use this action in a build/test workflow which leaves deployable code in `GITHUB_WORKSPACE`.
|
||||
The underlaying base-image of the docker-image is very small (Alpine (no cache)) which results in fast deployments.
|
||||
|
||||
---
|
||||
|
||||
@@ -48,9 +47,9 @@ jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/checkout@v2
|
||||
- name: rsync deployments
|
||||
uses: burnett01/rsync-deployments@2.0
|
||||
uses: burnett01/rsync-deployments@4.1
|
||||
with:
|
||||
switches: -avzr --delete
|
||||
path: src/
|
||||
@@ -63,19 +62,13 @@ jobs:
|
||||
Advanced:
|
||||
|
||||
```
|
||||
name: DEPLOY
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/checkout@v2
|
||||
- name: rsync deployments
|
||||
uses: burnett01/rsync-deployments@2.0
|
||||
uses: burnett01/rsync-deployments@4.1
|
||||
with:
|
||||
switches: -avzr --delete --exclude="" --include="" --filter=""
|
||||
path: src/
|
||||
@@ -89,19 +82,13 @@ jobs:
|
||||
For better security, I suggest you create additional secrets for remote_host, remote_port and remote_user inputs.
|
||||
|
||||
```
|
||||
name: DEPLOY
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/checkout@v2
|
||||
- name: rsync deployments
|
||||
uses: burnett01/rsync-deployments@2.0
|
||||
uses: burnett01/rsync-deployments@4.1
|
||||
with:
|
||||
switches: -avzr --delete
|
||||
path: src/
|
||||
@@ -114,6 +101,25 @@ jobs:
|
||||
|
||||
---
|
||||
|
||||
## Version 3.0
|
||||
|
||||
Looking for version 3.0?
|
||||
|
||||
Check here: https://github.com/Burnett01/rsync-deployments/tree/3.0
|
||||
|
||||
Version 3.0 uses the ``alpine:latest`` base-image directly.<br>
|
||||
Consider upgrading to 4.0 that uses a docker-image ``drinternet/rsync:1.0.1`` that is<br>
|
||||
based on ``alpine:latest``and heavily optimized for rsync.
|
||||
|
||||
## Version 2.0
|
||||
|
||||
Looking for version 2.0?
|
||||
|
||||
Check here: https://github.com/Burnett01/rsync-deployments/tree/2.0
|
||||
|
||||
Version 2.0 uses a larger base-image (``ubuntu:latest``).<br>
|
||||
Consider upgrading to 3.0 for even faster deployments.
|
||||
|
||||
## Version 1.0 (EOL)
|
||||
|
||||
Looking for version 1.0?
|
||||
@@ -121,3 +127,12 @@ Looking for version 1.0?
|
||||
Check here: https://github.com/Burnett01/rsync-deployments/tree/1.0
|
||||
|
||||
Please note that version 1.0 has reached end of life state.
|
||||
|
||||
---
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
+ This project is a fork of [Contention/rsync-deployments](https://github.com/Contention/rsync-deployments)
|
||||
+ Base image [JoshPiper/rsync-docker](https://github.com/JoshPiper/rsync-docker)
|
||||
|
||||
|
||||
|
||||
+13
-14
@@ -1,18 +1,17 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Start the SSH agent and load key.
|
||||
source agent-start "$GITHUB_ACTION"
|
||||
echo "$INPUT_REMOTE_KEY" | agent-add
|
||||
|
||||
# Add strict errors.
|
||||
set -eu
|
||||
|
||||
# Set deploy key
|
||||
SSH_PATH="$HOME/.ssh"
|
||||
# Variables.
|
||||
SWITCHES="$INPUT_SWITCHES"
|
||||
RSH="ssh -o StrictHostKeyChecking=no -p $INPUT_REMOTE_PORT $INPUT_RSH"
|
||||
LOCAL_PATH="$GITHUB_WORKSPACE/$INPUT_PATH"
|
||||
DSN="$INPUT_REMOTE_USER@$INPUT_REMOTE_HOST"
|
||||
|
||||
# Create .ssh dir if it doesn't exist
|
||||
[ -d "$SSH_PATH" ] || mkdir "$SSH_PATH"
|
||||
|
||||
# Place deploy_key into .ssh dir
|
||||
echo "$INPUT_REMOTE_KEY" > "$SSH_PATH/key"
|
||||
|
||||
# Set r+w to user only
|
||||
chmod 600 "$SSH_PATH/key"
|
||||
|
||||
# Do deployment
|
||||
sh -c "rsync $INPUT_SWITCHES -e 'ssh -i $SSH_PATH/key -o StrictHostKeyChecking=no -p $INPUT_REMOTE_PORT $INPUT_RSH' $GITHUB_WORKSPACE/$INPUT_PATH $INPUT_REMOTE_USER@$INPUT_REMOTE_HOST:$INPUT_REMOTE_PATH"
|
||||
# Deploy.
|
||||
sh -c "rsync $SWITCHES -e '$RSH' $LOCAL_PATH $DSN:$INPUT_REMOTE_PATH"
|
||||
|
||||
Reference in New Issue
Block a user