|
1 | | -# Setup code-server |
| 1 | +# Setup Coder code-server |
2 | 2 |
|
3 | 3 | 💻 Install [code-server] to run a local VS Code web instance |
4 | 4 |
|
| 5 | +<div align="center"> |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +</div> |
| 10 | + |
| 11 | +🌎 Installs `code-server` globally \ |
| 12 | +👨💻 Host your own VS Code web instance to debug CI \ |
| 13 | +🐧 Works on Linux and macOS runners \ |
| 14 | +⚠️ Not recommended for extended use \ |
| 15 | +🚀 No config! |
| 16 | + |
5 | 17 | ## Usage |
6 | 18 |
|
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +🛑 You will **not be able to connect** to the `localhost:4000` server unless you |
| 23 | +use a tunneling service like [Try Cloudflare] or [ngrok]. |
| 24 | + |
| 25 | +This GitHub Action will install the `code-server` binary globally. That means |
| 26 | +you can spin up your own local VS Code instance running _on the GitHub Actions |
| 27 | +runner_ at any point in your workflow! This is great for diving into a full IDE |
| 28 | +(if you need it) to diagnose a problem. For example, debugging the post-build |
| 29 | +folder structure and contents of a complex C++ project. Here's a quick demo of |
| 30 | +using `code-server` & `cloudflared` to expose a VS Code web instance to the |
| 31 | +entire world via [Try Cloudflare]. |
| 32 | + |
7 | 33 | ```yml |
8 | | -on: push |
| 34 | +on: workflow_dispatch |
9 | 35 | jobs: |
10 | 36 | code-server: |
11 | 37 | runs-on: ubuntu-latest |
12 | 38 | steps: |
13 | | - - uses: cidebug/setup-code-server@v1 |
14 | | - - uses: cidebug/setup-cloudflare-tunnel@v1 |
15 | | - - run: | |
16 | | - code-server --auth none --bind-addr 0.0.0.0:4000 & |
17 | | - cloudflared tunnel --url http://localhost:4000 & |
18 | | - wait -n |
| 39 | + - uses: ttyci/setup-code-server@v1 |
| 40 | + - uses: ttyci/setup-cloudflared@v1 |
| 41 | + - run: nohup code-server --auth none --bind-addr 0.0.0.0:4000 & |
| 42 | + - run: nohup cloudflared tunnel --url http://localhost:4000 & |
| 43 | + - run: sleep 5m |
19 | 44 | ``` |
20 | 45 |
|
21 | 46 | 📚 Make sure you check out [the code-server documentation] for a full list of |
22 | 47 | all the options that you can play around with! |
23 | 48 |
|
| 49 | +⚠️ Make sure you're aware of [the limits of GitHub Actions]! |
| 50 | +
|
| 51 | +### Options |
| 52 | +
|
| 53 | +There's currently only a single option to specify the version. Let me know if |
| 54 | +there's more options you'd like to see! ❤️ |
| 55 | +
|
| 56 | +- **`code-server-version`:** The specific pinned version of the `code-server` |
| 57 | + binary to install. This can also be the string `latest` to automatically |
| 58 | + install the latest version. Also supports the `edge` value to install |
| 59 | + prerelease versions. The default is `latest`. |
| 60 | + |
| 61 | +## Development |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +This GitHub Action is so simple that we can get away with using plain Bash. To |
| 66 | +get started, create a new fork/branch and open a PR! There's some tests in the |
| 67 | +`test-action.ym` workflow that will run to make sure everything "works". |
| 68 | + |
| 69 | +<!-- prettier-ignore-start --> |
24 | 70 | [code-server]: https://github.com/coder/code-server |
25 | 71 | [the code-server documentation]: https://coder.com/docs/code-server/latest/guide |
| 72 | +[try cloudflare]: https://try.cloudflare.com/ |
| 73 | +[the limits of GitHub Actions]: https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration |
| 74 | +[ngrok]: https://ngrok.com/ |
| 75 | +<!-- prettier-ignore-end --> |
0 commit comments