mirror of
https://github.com/HeyPuter/puter-worker-deploy-action.git
synced 2026-11-13 20:12:56 -10:00
main
build latest version of worker github action
Puter Worker Deploy Action
Uploads a worker's source (a folder or single file) to Puter FS, then deploys (or updates) a Puter Worker pointing at the entry file.
This action is bundled into dist/index.cjs and ships with:
@heyputer/puter.js@actions/core
Runtime: GitHub Actions node24.
Inputs
worker_name(required): Worker to manage, such asmy-apiormy-api.puter.workputer_path(required): Destination directory in Puter FS for the source (for example~/workers/my-api)puter_token(required): Puter auth token, usually fromsecretssource_path(optional, default.): Repo-relative file/folder to deployentry_file(optional, defaultindex.js): Worker entry file relative tosource_path(ignored whensource_pathis a single file)include_hidden(optional, defaultfalse): Include dotfiles/directoriesconcurrency(optional, default8): Number of concurrent uploads
Outputs
deployed_files: Number of uploaded filesworker_url: Deployed worker URL (typicallyhttps://<worker_name>.puter.work)deploy_action:createdorupdated
What It Does
- Initializes the Puter SDK from the bundled runtime (
@heyputer/puter.js/dist/puter.cjs) and sets your auth token. - Ensures
puter_pathexists as a directory. - Uploads files from
source_pathusing upsert behavior (puter.fs.write(..., { overwrite: true, createMissingParents: true })). - Resolves the entry file's remote path (
puter_path+entry_file). - Deploys the worker with
puter.workers.create(worker_name, entryPath). If a worker with that name already exists it is re-deployed and reported asupdated.
Usage
name: Deploy Worker To Puter
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy worker
id: puter_worker
uses: your-org/puter-worker-deploy-action@v1
with:
worker_name: my-api
source_path: worker
entry_file: index.js
puter_path: ~/workers/my-api
puter_token: ${{ secrets.PUTER_TOKEN }}
- name: Print URL
run: echo "Worker is live at ${{ steps.puter_worker.outputs.worker_url }}"
For a single-file worker, point source_path directly at the file (the entry_file input is ignored):
- name: Deploy worker
uses: your-org/puter-worker-deploy-action@v1
with:
worker_name: my-api
source_path: worker.js
puter_path: ~/workers/my-api
puter_token: ${{ secrets.PUTER_TOKEN }}
Local Validation
npm install
npm run check
npm run build
Commit dist/index.cjs after building. GitHub Actions executes that committed bundle directly.
Publish This Action
- Push this repo to GitHub (public if you want broad reuse).
- Create and push a release tag:
git add .
git commit -m "Release v1.0.0"
git tag v1.0.0
git push origin main --tags
- Create a moving major tag so users can stay on
v1:
git tag -f v1 v1.0.0
git push origin -f v1
- In consumer repos, use:
uses: your-org/puter-worker-deploy-action@v1
When you change src/deploy.mjs, rebuild before tagging:
npm run build:clean
git add src/deploy.mjs dist/index.cjs
git commit -m "Rebuild action bundle"
Publish To GitHub Marketplace (Optional)
- Open this repository on GitHub.
- Create a release from your tag (for example
v1.0.0). - On the release page, choose to publish the action to Marketplace and complete the listing form.
Description
GitHub Action: upload a workers source to Puter FS and deploy/update a Puter Worker.
320 KiB
0 Stars
1 Watchers
0 Forks