Skip to content

Commit

Permalink
Merge pull request #2 from rainstormy/sdi/validate-input-parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
spdiswal authored May 6, 2023
2 parents 9e89542 + 17f274c commit c567b79
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 6 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ name: Validate

on:
pull_request:
branches: [ main ]
branches:
- main
push:
branches:
- main
- v*

jobs:
validate-commit-messages:
Expand All @@ -14,7 +19,7 @@ jobs:
uses: rainstormy/github-action-validate-commit-messages@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
rules: 'acknowledged-author-email-addresses, acknowledged-author-names, acknowledged-committer-email-addresses, acknowledged-committer-names, capitalised-subject-lines, empty-line-after-subject-lines, imperative-subject-lines, limit-length-of-body-lines, limit-length-of-subject-lines, multi-word-subject-lines, no-co-authors, no-merge-commits, no-revert-revert-commits, no-squash-commits, no-trailing-punctuation-in-subject-lines, no-unexpected-whitespace'
rules: acknowledged-author-email-addresses, acknowledged-author-names, acknowledged-committer-email-addresses, acknowledged-committer-names, capitalised-subject-lines, empty-line-after-subject-lines, imperative-subject-lines, limit-length-of-body-lines, limit-length-of-subject-lines, multi-word-subject-lines, no-co-authors, no-merge-commits, no-revert-revert-commits, no-squash-commits, no-trailing-punctuation-in-subject-lines, no-unexpected-whitespace, unique-subject-lines
acknowledged-author-email-addresses--patterns: '\d+\+.+@users\.noreply\.github\.com'
acknowledged-author-names--patterns: '\p{Lu}.*\s.+'
acknowledged-committer-email-addresses--patterns: '\d+\+.+@users\.noreply\.github\.com'
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
= Changelog
:experimental:
:source-highlighter: highlight.js

This file documents all notable changes to this project.
The format is based on https://keepachangelog.com/en/1.1.0[Keep a Changelog], and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Versioning].

== https://github.com/rainstormy/github-action-deploy-with-rsync-over-ssh/compare/v1.0.1\...HEAD[Unreleased]

== https://github.com/rainstormy/github-action-deploy-with-rsync-over-ssh/compare/v1.0.0\...v1.0.1[1.0.1] - 2023-05-06
=== Added
* https://choosealicense.com/licenses/mit[MIT license].

=== Fixed
* Verify that all input parameters have been defined.

== https://github.com/rainstormy/github-action-deploy-with-rsync-over-ssh/releases/tag/v1.0.0[1.0.0] - 2023-04-10

=== Added
* GitHub Actions entrypoint.
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Rainstorm

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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
SOFTWARE.
55 changes: 51 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,65 @@ inputs:
runs:
using: composite
steps:
- name: Verify declaration of input parameters
env:
RSYNC_DESTINATION_PATH: ${{ inputs.rsync-destination-path }}
RSYNC_HOST: ${{ inputs.rsync-host }}
RSYNC_OPTIONS: ${{ inputs.rsync-options }}
RSYNC_SOURCE_PATH: ${{ inputs.rsync-source-path }}
SSH_KNOWN_HOSTS: ${{ inputs.ssh-known-hosts }}
SSH_PRIVATE_KEY: ${{ inputs.ssh-private-key }}
SSH_PRIVATE_KEY_FILENAME: ${{ inputs.ssh-private-key-filename }}
run: |
if [[ -z "$RSYNC_DESTINATION_PATH" ]]; then
echo "The input parameter 'rsync-destination-path' must be non-empty."
exit 1
fi
if [[ -z "$RSYNC_HOST" ]]; then
echo "The input parameter 'rsync-host' must be non-empty."
exit 1
fi
if [[ -z "$RSYNC_OPTIONS" ]]; then
echo "The input parameter 'rsync-options' must be non-empty."
exit 1
fi
if [[ -z "$RSYNC_SOURCE_PATH" ]]; then
echo "The input parameter 'rsync-source-path' must be non-empty."
exit 1
fi
if [[ -z "$SSH_KNOWN_HOSTS" ]]; then
echo "The input parameter 'ssh-known-hosts' must be non-empty."
exit 1
fi
if [[ -z "$SSH_PRIVATE_KEY" ]]; then
echo "The input parameter 'ssh-private-key' must be non-empty."
exit 1
fi
if [[ -z "$SSH_PRIVATE_KEY_FILENAME" ]]; then
echo "The input parameter 'ssh-private-key-filename' must be non-empty."
exit 1
fi
shell: bash

- name: Prepare the SSH configuration
env:
SSH_KNOWN_HOSTS: ${{ inputs.ssh-known-hosts }}
SSH_PRIVATE_KEY: ${{ inputs.ssh-private-key }}
SSH_PRIVATE_KEY_FILENAME: ${{ inputs.ssh-private-key-filename }}
run: |
mkdir ~/.ssh
echo "${{ inputs.ssh-known-hosts }}" > ~/.ssh/known_hosts
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
echo "${{ inputs.ssh-private-key }}" > ~/.ssh/${{ inputs.ssh-private-key-filename }}
chmod 600 ~/.ssh/${{ inputs.ssh-private-key-filename }}
echo "$SSH_PRIVATE_KEY" > ~/.ssh/"$SSH_PRIVATE_KEY_FILENAME"
chmod 600 ~/.ssh/"$SSH_PRIVATE_KEY_FILENAME"
shell: bash

- name: Deploy with Rsync
env:
RSYNC_DESTINATION_PATH: ${{ inputs.rsync-destination-path }}
RSYNC_HOST: ${{ inputs.rsync-host }}
run: |
rsync ${{ inputs.rsync-options }} ${{ inputs.rsync-source-path }} ${{ inputs.rsync-host }}:${{ inputs.rsync-destination-path }}
rsync ${{ inputs.rsync-options }} ${{ inputs.rsync-source-path }} "$RSYNC_HOST":"$RSYNC_DESTINATION_PATH"
shell: bash

- if: always()
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"license": "MIT",
"packageManager": "yarn@3.5.0",
"private": true
}

0 comments on commit c567b79

Please sign in to comment.