Github Actions documentation/example for Surfer
-
N nebulon marked this topic as a question on
-
I did not test it, as all my ci is still either in Drone at home or Gitlab at work. But from my understanding it should look like this:
- name: Deploy to Surfer uses: addnab/docker-run-action@v3 with: image: git.9wd.eu/9wd/surfer-action:latest run: | surfer --version surfer put --token $SURFTOKEN --server $SURFURL public/* /(the referenced container is the surfer image I built and have been using for years)
-
I did not test it, as all my ci is still either in Drone at home or Gitlab at work. But from my understanding it should look like this:
- name: Deploy to Surfer uses: addnab/docker-run-action@v3 with: image: git.9wd.eu/9wd/surfer-action:latest run: | surfer --version surfer put --token $SURFTOKEN --server $SURFURL public/* /(the referenced container is the surfer image I built and have been using for years)
@fbartels awesome, thank you! Will try this out.
Update: very close!
Using server https://localhost.dwebyvr.org node:fs:1659 const stats = binding.stat( ^ Error: ENOENT: no such file or directory, stat '/website/*' at Object.statSync (node:fs:1659:25) at collectFiles (/usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:60:19) at /usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:225:40 at Array.forEach (<anonymous>) at Command.put (/usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:221:15) at Command.listener [as _actionHandler] (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:494:17) at /usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1296:65 at Command._chainOrCall (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1193:12) at Command._parseCommand (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1296:27) at /usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1082:27 { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/website/*' }So somehow have to give it context of the checked out repo I guess?
Here's the file in the repo I'm working with: https://github.com/DWebYVR/localhost_vancouver_webring/blob/main/.github/workflows/surfer.yml
-
@fbartels awesome, thank you! Will try this out.
Update: very close!
Using server https://localhost.dwebyvr.org node:fs:1659 const stats = binding.stat( ^ Error: ENOENT: no such file or directory, stat '/website/*' at Object.statSync (node:fs:1659:25) at collectFiles (/usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:60:19) at /usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:225:40 at Array.forEach (<anonymous>) at Command.put (/usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:221:15) at Command.listener [as _actionHandler] (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:494:17) at /usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1296:65 at Command._chainOrCall (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1193:12) at Command._parseCommand (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1296:27) at /usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1082:27 { errno: -2, code: 'ENOENT', syscall: 'stat', path: '/website/*' }So somehow have to give it context of the checked out repo I guess?
Here's the file in the repo I'm working with: https://github.com/DWebYVR/localhost_vancouver_webring/blob/main/.github/workflows/surfer.yml
@bmann said in Github Actions documentation/example for Surfer:
/website/*
This is a bit weird. In the output above it complains that it cannot find
/website/, while in your yaml you are passingwebsite/. The first one would be no surprise if it does not work, the second one however should work as ci tools usually open a shell where you will be directly in your git checkout.I would try to debug this with inserting a few
lsandpwdinto your yaml to see where you actually are and if this might be a permission issue of some kind. -
J james marked this topic as a regular topic on
-
Got this working for myself:
- create an environment and define your
SURFER_TOKEN/SURFER_HOSTsecrets there - set the environment in your job
- expose the secrets to the
runcommand
My example assumes:
- environment name
alfa - you want to upload the
bravodirectory… - to your server under
/charlie/delta
name: Deploy on: [push] jobs: build_site: runs-on: ubuntu-latest environment: alfa steps: - name: Checkout uses: actions/checkout@v4 # … other steps for install, build, etc… - name: Install surfer run: npm -g install cloudron-surfer - name: Upload env: SURFER_TOKEN: ${{ secrets.SURFER_TOKEN }} SURFER_HOST: ${{ secrets.SURFER_HOST }} run: surfer put --token "$SURFER_TOKEN" --server "$SURFER_HOST" bravo/* /charlie/delta - create an environment and define your
-
Hello @rosano
We actually published a GitHub action for a more generic use-case.
https://github.com/cloudron-io/cloudron-push-to-app@james i didn't get an email notification for this reply, good to know!
i think the use case described previously is more for static sites with surfer (my personal preference as github pages can be super slow to create and upload artifacts).
but nonetheless, could you clarify why it seems to push without any docker build step? i'm used to installing custom apps from registries after building so this "push code" concept seems novel.
(edit: my email was outdated… just updated)