From 0ce01833a411ca85df69197cb66a83b40fc4205d Mon Sep 17 00:00:00 2001 From: klemek Date: Sat, 2 May 2026 22:36:11 +0200 Subject: [PATCH] v1 --- README.md | 30 ++++++++++++++++++++++++++++++ action.yml | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 README.md create mode 100644 action.yml diff --git a/README.md b/README.md new file mode 100644 index 0000000..fca6143 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Stapler Deploy + +## Sample CI + +```yaml +name: Docker Build CI +on: [ push ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: actions/stapler-deploy@v1 + with: + path: dist + token: ${{ secrets.STAPLER_TOKEN }} + target: ${{ github.repository }} + extra_curl_args: ${{ vars.STAPLER_CURL_ARGS }} +``` + +## Arguments + +| Name | Description | Default value | +| --- | --- | --- | +| `path` | directory path to deploy | `.` | +| `token` | Stapler token | (required) | +| `host` | Stapler host | `https://stapler.fr` | +| `target` | Stapler target path | (required) | +| `extra_curl_args` | Extra Curl args like: -H 'X-Host-Only: example.org' | (empty) | diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..6c5d6ae --- /dev/null +++ b/action.yml @@ -0,0 +1,37 @@ +name: "Stapler Deploy" +description: "Deploy directory to Stapler instance" + +inputs: + path: + description: "directory path to deploy" + required: true + default: "." + token: + description: "Stapler token" + required: true + host: + description: "Stapler host" + required: true + default: "https://stapler.fr" + target: + description: "Stapler target path" + required: true + extra_curl_args: + description: "Extra Curl args like: -H 'X-Host-Only: example.org'" + default: "" + +runs: + using: "composite" + steps: + - name: Compress files + shell: bash + run: tar -czC ${{ inputs.path }} -f /tmp/dist.tar.gz . + + - name: Upload to Stapler server + shell: bash + run: | + TARGET=$(echo ${{ inputs.target }}|rev|cut -d/ -f1|rev) + curl -s -X PUT --fail-with-body --data-binary "@/tmp/dist.tar.gz" \ + -H 'X-Token: ${{ inputs.token }}' \ + ${{ inputs.extra_curl_args }} \ + ${{ inputs.host }}/$TARGET/