Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Sep 28, 2020
0 parents commit 6fcfd7b
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
secret
my
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
LABEL "com.github.actions.name"="WooCart Deploy"
LABEL "com.github.actions.description"="Deploy changes from your GitHUb repository to your store."
LABEL "com.github.actions.icon"="upload-cloud"
LABEL "com.github.actions.color"="blue"
LABEL "maintainer"="Niteo.co <[email protected]>"

FROM alpine:3.11

RUN apk add --no-cache bash curl unzip ca-certificates fuse openssh-client jq \
&& wget -qO- https://rclone.org/install.sh | bash \
&& apk del bash curl unzip

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test:
env INPUT_URL=http://localhost:8080 INPUT_USERNAME=admin INPUT_PASSWORD=secret INPUT_REMOTE=/plugins/woocommerce INPUT_LOCAL=my/plugins/woocommerce bash entrypoint.sh

49 changes: 49 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# WooCart Deploy Action

Sync your GitHub repository with your store on WooCart.com.

## Inputs

### `url`

**Required** The URL of WebDAV server (starting with https://...)

### `username`

**Required** The name of the user.

### `password`

**Required** The password for the user.

### `local`

**Required** Path in GitHub repository to sync.

### `remote`

**Required** Path on remote to sync into.

## Example usage

1. Create a `.github/workflows/deploy.yml` file in your GitHub repo, if one doesn't exist already.
2. Add the following code to the `deploy.yml` file.
```yaml
name: Deploy my-plugin
on: push
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy my-plugin to WooCart
uses: woocart/deploy-action@v3
with:
url: ${{ secrets.WEBDAV_URL }}
username: ${{ secrets.WEBDAV_USERNAME }}
password: ${{ secrets.WEBDAV_PASSWORD }}
local: "dist/"
remote: "plugins/my-plugin"
```
3. Create `WEBDAV_URL`, `WEBDAV_USERNAME`, `WEBDAV_PASSWORD` secret using [GitHub Action's Secret](https://developer.github.com/actions/creating-workflows/storing-secrets). You can find these values in WooCart > Settings tab for your store.
24 changes: 24 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'WooCart Deploy'
description: 'Deploy changes from your GitHUb repository to your store.'
inputs:
url:
description: 'WEBDAV url'
required: true
username:
description: 'WEBDAV user'
required: true
password:
description: 'WEBDAV password'
required: true
local:
description: 'Local directory'
required: true
remote:
description: 'Remote directory'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
branding:
color: 'purple'
icon: 'upload-cloud'
17 changes: 17 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# shellcheck disable=SC2001,SC2002,SC2034,SC1090,SC2154,SC1117

# Fail fast and fail hard.
set -Eeuo pipefail

mkdir -p ~/.config/rclone/
echo "
[woocart]
type = webdav
pass = $(rclone obscure $INPUT_PASSWORD)
url = $INPUT_URL
user = $INPUT_USERNAME
vendor = other
" > ~/.config/rclone/rclone.conf

rclone -v sync $INPUT_LOCAL woocart:$INPUT_REMOTE

0 comments on commit 6fcfd7b

Please sign in to comment.