|
2 | 2 |
|
3 | 3 | GitHub Pages can host the static files that Tableau produces. This guide walks through a production-ready setup that you can adopt for your own site. |
4 | 4 |
|
5 | | -## 1. Prepare your Tableau project |
| 5 | +## Prepare your Tableau project |
6 | 6 |
|
7 | | -1. Ensure your project exposes a `build` alias that calls `tableau.build`. The generator already includes this: |
8 | | - |
9 | | - ```elixir |
10 | | - # mix.exs |
11 | | - defp aliases do |
12 | | - [ |
13 | | - build: ["tableau.build"] |
14 | | - ] |
15 | | - end |
16 | | - ``` |
17 | | - |
18 | | -2. Make sure `_site/` is gitignored. Tableau writes the built site there and your workflow will upload it as an artifact: |
19 | | - |
20 | | - ```gitignore |
21 | | - /_site/ |
22 | | - ``` |
23 | | - |
24 | | -3. Configure your production URL in `config/prod.exs`. If you use a custom domain, set it to that value: |
| 7 | +1. Configure your production URL in `config/prod.exs`. If you use a custom domain, set it to that value: |
25 | 8 |
|
26 | 9 | ```elixir |
27 | 10 | # config/prod.exs |
28 | 11 | config :tableau, :config, |
29 | 12 | url: "https://your-domain.tld" |
30 | 13 | ``` |
31 | 14 |
|
32 | | - For GitHub Pages sites served from `<user>.github.io/<repo>`, use the full Pages URL and optionally set `base_path: "/<repo>"` so links render correctly locally. |
| 15 | +2. If you serve additional assets (Tailwind, esbuild, etc.), add the corresponding Mix tasks to the `build` alias so they also run in CI. |
33 | 16 |
|
34 | | -4. If you serve additional assets (Tailwind, esbuild, etc.), add the corresponding Mix tasks to the `build` alias so they also run in CI. |
35 | | - |
36 | | -## 2. Add the GitHub Pages workflow |
| 17 | +## Add the GitHub Pages workflow |
37 | 18 |
|
38 | 19 | Create `.github/workflows/deploy.yml` with the following workflow. It installs Erlang/OTP + Elixir, builds the site in production mode, and publishes the `_site` directory to GitHub Pages: |
39 | 20 |
|
@@ -105,20 +86,23 @@ jobs: |
105 | 86 | - If `mix build` already chains your asset pipelines, no other changes are needed. Otherwise, insert additional steps before "Upload artifact". |
106 | 87 | - The cache step speeds up successive runs but can be removed if you prefer. |
107 | 88 |
|
108 | | -## 3. Enable GitHub Pages |
| 89 | +## Enable GitHub Pages |
109 | 90 |
|
110 | 91 | 1. Push the workflow to your default branch (the example uses `main`). |
111 | 92 | 2. In your repository, open **Settings → Pages**. |
112 | 93 | 3. Under **Build and deployment**, choose **GitHub Actions**. |
113 | 94 | 4. After the first successful run, the deployment will appear under the **Deployments** tab and the workflow output prints the public URL. |
114 | 95 |
|
115 | | -## 4. Using a custom domain |
| 96 | +## Custom domains & pages.io URLs |
116 | 97 |
|
117 | 98 | If you have a custom domain: |
118 | 99 |
|
119 | 100 | - Add a `CNAME` file at the repo root containing the domain, e.g. `example.com`. |
120 | 101 | - Configure your DNS to point at GitHub Pages. |
121 | 102 | - Keep `config :tableau, :config, url: "https://your-domain"` in sync so absolute links are generated correctly. |
| 103 | +- GitHub’s docs cover the DNS details in depth: <https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages>. |
| 104 | +
|
| 105 | +If you deploy to `<user>.github.io/<repo>`, use the full Pages URL (e.g. `https://username.github.io/my-site`) and optionally set `base_path: "/my-site"` in `config/prod.exs` so local links match production. |
122 | 106 |
|
123 | 107 | ## Troubleshooting |
124 | 108 |
|
|
0 commit comments