Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC for V1.2 #3

Merged
merged 21 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/action_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Action test

on:
push:
workflow_dispatch:

jobs:
rsyncversion:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
show-progress: ''
- name: Setup rsync
uses: './'
- run: rsync --version
4 changes: 3 additions & 1 deletion .github/workflows/macos_action_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Action test on MacOS
on:
schedule:
- cron: "0 4 * * MON-FRI" # Runs at 04:00 UTC
push:
push:
branches:
- main
workflow_dispatch:

jobs:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ubuntu_action_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Action test on Ubuntu
on:
schedule:
- cron: "0 2 * * MON-FRI" # Runs at 02:00 UTC
push:
push:
branches:
- main
workflow_dispatch:

jobs:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/windows_action_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Action test on Windows
on:
schedule:
- cron: "0 6 * * MON-FRI" # Runs at 06:00 UTC
push:
push:
branches:
- main
workflow_dispatch:

jobs:
Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,29 @@ _**Note**: This action is supported on **all runners** operating systems (`ubunt

## 📚 Usage

### Ubuntu
### Common

```yaml
runs-on: ubuntu-latest
steps:
- uses: GuillaumeFalourd/setup-rsync@v1.1
- run: rsync --version
```

### MacOs
### SSH KEY

```yaml
runs-on: macos-latest
steps:
- uses: GuillaumeFalourd/setup-rsync@v1.1
id: rsync
with:
ssh_key: ${{ secrets.MY_SSH_KEY }}
- run: echo "SSK KEY PATH ${{ steps.rsync.outputs.ssh_key_path }}"
- run: rsync --version
```

### Windows
## ▶️ Action Inputs / Outputs

```yaml
runs-on: windows-latest
steps:
- uses: GuillaumeFalourd/setup-rsync@v1.1
- run: rsync --version
```
This action can receive a `ssh_key` input, which will be stored in a temporary file to perform further operations afterwards using the `ssh_key_path` output generated by the action.

## 🤝 Contributing

Expand Down
78 changes: 57 additions & 21 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,77 @@
name: 'Setup Rsync'
description: 'Github actions to setup Rsync (all os supported) 🔄'

inputs:
ssh_key:
description: SSH KEY to setup
required: false

outputs:
ssh_key_path:
description: "SSH KEY path"
value: ${{ steps.setup_ssh_key.outputs.ssh_key_path }}

runs:
using: "composite"
steps:
- name: Install Rsync
- name: Check OS
id: ostype
run: |
if [[ $OSTYPE == 'msys'* ]]; then
echo "windows runner detected"
curl.exe --output rsync-3.2.3-2-x86_64.pkg.tar.zst --url https://repo.msys2.org/msys/x86_64/rsync-3.2.3-1-x86_64.pkg.tar.zst
zstd -d rsync-3.2.3-2-x86_64.pkg.tar.zst
tar -xvf rsync-3.2.3-2-x86_64.pkg.tar
mv usr/bin/rsync.exe "C:\Program Files\Git\usr\bin\\"
curl.exe --output libzstd-1.5.2-1-x86_64.pkg.tar.zst https://repo.msys2.org/msys/x86_64/libzstd-1.5.2-1-x86_64.pkg.tar.zst
zstd -d libzstd-1.5.2-1-x86_64.pkg.tar.zst
tar -xvf libzstd-1.5.2-1-x86_64.pkg.tar
mv usr/bin/msys-zstd-1.dll "C:\Program Files\Git\usr\bin\\"
curl.exe --output libxxhash-0.8.0-1-x86_64.pkg.tar.zst https://repo.msys2.org/msys/x86_64/libxxhash-0.8.0-1-x86_64.pkg.tar.zst
zstd -d libxxhash-0.8.0-1-x86_64.pkg.tar.zst
tar -xvf libxxhash-0.8.0-1-x86_64.pkg.tar
mv usr/bin/msys-xxhash-0.8.0.dll "C:\Program Files\Git\usr\bin\\"
echo "rsync installed on windows runner"
echo "Windows detected"
echo "ostype=windows" >> $GITHUB_OUTPUT
elif [[ $OSTYPE == 'darwin'* ]]; then
echo "macos runner detected"
brew install rsync
echo "rsync installed on macos runner"
echo "MacOS detected"
echo "ostype=macos" >> $GITHUB_OUTPUT
else
echo "ubuntu runner detected"
sudo apt-get install rsync
echo "rsync installed on ubuntu runner"
echo "Linux detected"
echo "ostype=linux" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Install Rsync Windows
if: steps.ostype.outputs.ostype == 'windows'
run: |
choco install --no-progress rsync
shell: pwsh

- name: Install Rsync MacOS
if: steps.ostype.outputs.ostype == 'macos'
run: |
echo "macos runner detected"
brew install rsync
echo "rsync installed on macos runner"
shell: bash

- name: Install Rsync Ubuntu
if: steps.ostype.outputs.ostype == 'linux'
run: |
echo "ubuntu runner detected"
sudo apt-get update
GuillaumeFalourd marked this conversation as resolved.
Show resolved Hide resolved
sudo apt-get install rsync
GuillaumeFalourd marked this conversation as resolved.
Show resolved Hide resolved
echo "rsync installed on ubuntu runner"
shell: bash

- name: Check Rsync version
run: rsync --version
shell: bash

- name: Setup SSH KEY
id: setup_ssh_key
run: |
if [ -z "${{ inputs.ssh_key }}" ]; then
echo "INFO: No SSH KEY provided."
elif [ -z "$CYGWIN" ]; then
GuillaumeFalourd marked this conversation as resolved.
Show resolved Hide resolved
temp_path="${{ runner.temp }}"
temp_path="${temp_path//\\//}"
echo "${{ inputs.ssh_key }}" > "${temp_path}/sshkey"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, this did not work on Cygwin bash. Hopefully, it does on git bash.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to identify if it's using cygwin or git before executing those commands?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable CYGWIN is set in the case of the former.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've update this section in the action.yaml file if you want to have a look 👍🏼

chmod 600 "${{runner.temp}}/sshkey"
echo "ssh_key_path=${{runner.temp}}/sshkey" >> $GITHUB_OUTPUT
else
echo "This action is not supported on CYGWIN Bash"
fi
shell: bash

branding:
icon: arrow-right-circle
color: blue