Skip to content

Commit 4d4cebd

Browse files
authored
docs: add dnslink-action guide and update related pages (#2236)
* docs: add dnslink-action guide and update related pages - add new guide for automating DNSLink updates with GitHub Actions - fix ipfs-deploy-action namespace (ipfs -> ipshipyard) - add next steps section to deploy-github-action guide - update custom-domains and dnslink-gateway with links to new guide - add dnslink-action to navigation * docs: add generic DNS tools alternative to dnslink-action guide * chore: reorder Websites on IPFS nav for educational flow
1 parent 04dd310 commit 4d4cebd

File tree

6 files changed

+194
-13
lines changed

6 files changed

+194
-13
lines changed

.github/styles/pln-ignore.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ dns('s)
8181
dnsaddr
8282
dnscontrol
8383
dnslink
84+
DNSimple
8485
dotgraph
8586
dups
8687
durin
8788
dweb
8889
embeddable
8990
eternum
91+
exfiltrate
9092
ethereum
9193
explainers
9294
fabien
@@ -103,6 +105,7 @@ fleek
103105
Fleek's
104106
fleek('s)
105107
fqdns
108+
Gandi
106109
gasless
107110
geospatial
108111
gif
@@ -192,6 +195,7 @@ nakamoto
192195
nakamoto's
193196
namebase
194197
namecheap
198+
nameserver
195199
namespace
196200
nats
197201
neocities
@@ -292,6 +296,7 @@ vue
292296
Vuepress
293297
wantlist
294298
wantlists
299+
walkthrough
295300
WASM
296301
web
297302
webpack

docs/.vuepress/config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,14 @@ module.exports = {
256256
sidebarDepth: 1,
257257
collapsable: true,
258258
children: [
259-
'/how-to/websites-on-ipfs/deploy-github-action',
260-
'/how-to/websites-on-ipfs/custom-domains',
261259
'/how-to/websites-on-ipfs/single-page-website',
262-
'/how-to/websites-on-ipfs/dnslink-gateway',
263260
'/how-to/websites-on-ipfs/multipage-website',
264261
'/how-to/websites-on-ipfs/static-site-generators',
265-
'/how-to/websites-on-ipfs/redirects-and-custom-404s'
262+
'/how-to/websites-on-ipfs/redirects-and-custom-404s',
263+
'/how-to/websites-on-ipfs/custom-domains',
264+
'/how-to/websites-on-ipfs/deploy-github-action',
265+
'/how-to/websites-on-ipfs/dnslink-action',
266+
'/how-to/websites-on-ipfs/dnslink-gateway',
266267
]
267268
},
268269
{

docs/how-to/websites-on-ipfs/custom-domains.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ With this approach, users can access your website via a custom domain name, e.g.
4141
To provide access to the app directly via the custom domain, you have the following options:
4242

4343
1. Self-host both the IPFS provider (e.g. [Kubo](https://github.com/ipfs/kubo)) and the IPFS HTTP gateway (e.g. [Kubo](https://github.com/ipfs/kubo)). Deploy an IPFS Gateway that supports DNSLink resolution and point the `CNAME`/`A` DNS record for your custom domain to it and update the `TXT` record on `_dnslink` subdomain to match CID of your website. [See the guide on setting up a DNSLink gateway](./dnslink-gateway.md) for more details.
44-
2. Deploy the site to a web hosting service like [Cloudflare Pages](https://pages.cloudflare.com/) or [GitHub Pages](https://pages.github.com/) with a custom domain (pointing and configuring the `CNAME`/`A` record for your custom domain on the web hosting service), while managing the DNSLink `TXT` record on `_dnslink` subdomain separately, essentially getting the benefits of both IPFS and traditional web hosting. Remember to set up CI automation to update the DNSLink `TXT` record for every deployment that changes the CID.
44+
2. Deploy the site to a web hosting service like [Cloudflare Pages](https://pages.cloudflare.com/) or [GitHub Pages](https://pages.github.com/) with a custom domain (pointing and configuring the `CNAME`/`A` record for your custom domain on the web hosting service), while managing the DNSLink `TXT` record on `_dnslink` subdomain separately, essentially getting the benefits of both IPFS and traditional web hosting. Use the [DNSLink Action](./dnslink-action.md) to automatically update the DNSLink `TXT` record for every deployment that changes the CID. If you prefer to run your own HTTP server, see [Setup a DNSLink Gateway with Kubo and Caddy](./dnslink-gateway.md).
4545

docs/how-to/websites-on-ipfs/deploy-github-action.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
run: npm run build
131131

132132
- name: Deploy to IPFS
133-
uses: ipfs/ipfs-deploy-action@v1
133+
uses: ipshipyard/ipfs-deploy-action@v1
134134
id: deploy
135135
with:
136136
path-to-deploy: dist # Change this to your build output directory
@@ -156,7 +156,7 @@ To upload the CAR file to a Kubo node instead of or in addition to Storacha:
156156

157157
```yaml
158158
- name: Deploy to IPFS
159-
uses: ipfs/ipfs-deploy-action@v1
159+
uses: ipshipyard/ipfs-deploy-action@v1
160160
with:
161161
# ... other inputs ...
162162
kubo-api-url: ${{ secrets.KUBO_API_URL }}
@@ -167,7 +167,7 @@ You can also customize the Kubo version and [`ipfs add` parameters](https://docs
167167

168168
```yaml
169169
- name: Deploy to IPFS
170-
uses: ipfs/ipfs-deploy-action@v1
170+
uses: ipshipyard/ipfs-deploy-action@v1
171171
with:
172172
# ... other inputs ...
173173
kubo-version: 'v0.39.0' # Default, change if needed
@@ -184,7 +184,7 @@ To upload the CAR file to an IPFS Cluster:
184184

185185
```yaml
186186
- name: Deploy to IPFS
187-
uses: ipfs/ipfs-deploy-action@v1
187+
uses: ipshipyard/ipfs-deploy-action@v1
188188
with:
189189
# ... other inputs ...
190190
cluster-url: ${{ secrets.CLUSTER_URL }}
@@ -196,7 +196,7 @@ You can also configure additional IPFS Cluster options:
196196

197197
```yaml
198198
- name: Deploy to IPFS
199-
uses: ipfs/ipfs-deploy-action@v1
199+
uses: ipshipyard/ipfs-deploy-action@v1
200200
with:
201201
# ... other inputs ...
202202
cluster-retry-attempts: '5' # Override number of retry attempts
@@ -217,7 +217,7 @@ To pin your content to Pinata:
217217

218218
```yaml
219219
- name: Deploy to IPFS
220-
uses: ipfs/ipfs-deploy-action@v1
220+
uses: ipshipyard/ipfs-deploy-action@v1
221221
with:
222222
# ... other inputs ...
223223
pinata-jwt-token: ${{ secrets.PINATA_JWT_TOKEN }}
@@ -236,7 +236,7 @@ To store CAR files on Filebase:
236236

237237
```yaml
238238
- name: Deploy to IPFS
239-
uses: ipfs/ipfs-deploy-action@v1
239+
uses: ipshipyard/ipfs-deploy-action@v1
240240
with:
241241
# ... other inputs ...
242242
filebase-bucket: 'your-bucket-name'
@@ -295,6 +295,14 @@ This URL uses subdomain resolution (where the CID has its own subdomain), which
295295
3. Consider using multiple IPFS providers for redundancy
296296
4. Use environment-specific configurations when needed
297297

298+
## Next Steps
299+
300+
After deploying your site to IPFS, you may want to:
301+
302+
- **Add a custom domain**: Use [DNSLink](./dnslink-action.md) to automatically update DNS records so users can access your site via a human-readable domain name like `yourdomain.com` instead of a CID.
303+
- **Set up a DNSLink gateway**: If you want to serve your site directly from your own domain over HTTPS, see [Setup a DNSLink Gateway](./dnslink-gateway.md).
304+
- **Learn about custom domains**: For an overview of domain options, see [Custom domains and DNSLink](./custom-domains.md).
305+
298306
## Getting Help
299307

300308
If you encounter any issues:
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
title: Automate DNSLink updates with GitHub Actions
3+
description: Guide on how to use the DNSLink Action to automatically update DNS records when deploying static sites to IPFS.
4+
---
5+
6+
# Automate DNSLink updates with GitHub Actions
7+
8+
This guide explains how to automatically update [DNSLink](../../concepts/dnslink.md) records when you deploy your site to IPFS. By the end, your DNS will automatically point to the latest CID whenever you push to your repository.
9+
10+
DNSLink lets users access your IPFS-hosted content through a human-readable domain name like `docs.ipfs.tech` instead of a CID like `bafybeic...`. When combined with [ipshipyard/ipfs-deploy-action](./deploy-github-action.md), you get a complete CI/CD pipeline for IPFS websites.
11+
12+
## Prerequisites
13+
14+
Before you begin, make sure you have:
15+
16+
1. Your site deployed to IPFS with a CID (see [Deploy static apps to IPFS with GitHub Actions](./deploy-github-action.md))
17+
2. A domain name with DNS managed by a [supported provider](#step-1-configure-dns-provider) (Cloudflare, DNSimple, or Gandi), or any provider via [generic DNS tools](#alternative-generic-dns-tools)
18+
3. A GitHub repository with Actions enabled
19+
20+
## Security Considerations
21+
22+
::: warning API Token Security
23+
DNS API tokens are sensitive credentials. A compromised token could allow attackers to modify your DNS records, potentially redirecting your domain to malicious content.
24+
25+
For open source projects that accept pull requests from forks, use the [two-workflow pattern](#two-workflow-pattern-for-open-source-projects) to ensure fork code never has access to your DNS credentials.
26+
:::
27+
28+
## Step 1: Configure DNS Provider
29+
30+
The [dnslink-action](https://github.com/ipshipyard/dnslink-action) provides turn-key DNSLink updates with built-in safety features for the providers below. If your provider is not listed, see [Alternative: Generic DNS Tools](#alternative-generic-dns-tools).
31+
32+
### Option A: Cloudflare (recommended)
33+
34+
1. Log into the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your domain
35+
2. Go to the **Overview** tab and scroll down to find your **Zone ID** ([detailed instructions](https://github.com/ipshipyard/dnslink-action#finding-your-zone-id))
36+
3. Go to **My Profile** > **API Tokens** > **Create Token** ([detailed instructions](https://github.com/ipshipyard/dnslink-action#creating-an-api-token))
37+
4. Create a custom token with these permissions:
38+
- Zone > DNS > Edit
39+
- Scope the token to your specific zone
40+
5. Add both values as [GitHub secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions):
41+
- `CF_ZONE_ID`: Your Zone ID
42+
- `CF_AUTH_TOKEN`: Your API token
43+
44+
For a visual walkthrough, see the [Cloudflare video tutorial](https://github.com/ipshipyard/dnslink-action#cloudflare-video-tutorial).
45+
46+
### Option B: DNSimple
47+
48+
1. Log into DNSimple and go to **Account** > **Access Tokens**
49+
2. Create a new API token
50+
3. Add it as a GitHub secret named `DNSIMPLE_TOKEN`
51+
52+
### Option C: Gandi
53+
54+
1. Log into [Gandi](https://www.gandi.net/) and go to **Account** > **Security** > **Personal Access Tokens**
55+
2. Create a new token with DNS management permissions
56+
3. Add it as a GitHub secret named `GANDI_TOKEN`
57+
58+
## Step 2: Add DNSLink Action to Your Workflow
59+
60+
Add [ipshipyard/dnslink-action](https://github.com/ipshipyard/dnslink-action) to your workflow after deploying to IPFS. The action takes the CID from [ipshipyard/ipfs-deploy-action](https://github.com/ipshipyard/ipfs-deploy-action) and updates your DNS record.
61+
62+
For complete workflow examples, see:
63+
64+
- [Simple workflow (no fork PRs)](https://github.com/ipshipyard/ipfs-deploy-action#simple-workflow-no-fork-prs) - single workflow for repositories that don't accept external contributions
65+
- [Dual workflows (with fork PRs)](https://github.com/ipshipyard/ipfs-deploy-action#dual-workflows-with-fork-prs) - secure pattern for open source projects
66+
67+
For DNS provider-specific configuration, see the [ipshipyard/dnslink-action README](https://github.com/ipshipyard/dnslink-action#usage).
68+
69+
## Step 3: Verify the DNSLink Record
70+
71+
After the workflow runs, verify the DNSLink record:
72+
73+
```bash
74+
dig +short TXT _dnslink.yourdomain.com
75+
```
76+
77+
You should see output like:
78+
79+
```
80+
"dnslink=/ipfs/bafybeic..."
81+
```
82+
83+
## Alternative: Generic DNS Tools
84+
85+
If your DNS provider is not supported by dnslink-action, or you need more control over DNS updates, you can use generic DNS automation tools in a custom workflow step.
86+
87+
DNSLink is a TXT record on the `_dnslink` subdomain. To update it, set a TXT record on `_dnslink.yourdomain.com` with the value:
88+
89+
```
90+
dnslink=/ipfs/<CID>
91+
```
92+
93+
Where `<CID>` is the output from [ipshipyard/ipfs-deploy-action](https://github.com/ipshipyard/ipfs-deploy-action).
94+
95+
Tools that support many DNS providers:
96+
97+
- [OctoDNS](https://github.com/octodns/octodns) - supports [many providers](https://octodns.readthedocs.io/en/latest/#providers) including AWS Route53, Google Cloud DNS, Azure DNS, DigitalOcean, and NS1. Can run in CI to sync DNS records from config files.
98+
- [Terraform DNS providers](https://registry.terraform.io/search/providers?q=dns) - useful if you already manage infrastructure with Terraform.
99+
- Your provider's API directly via a custom script or GitHub Action step.
100+
101+
## Two-Workflow Pattern for Open Source Projects
102+
103+
For repositories that accept pull requests from forks, use a two-workflow pattern to keep secrets secure. This is critical because **pull requests from forks can contain malicious code that could exfiltrate your secrets**.
104+
105+
The solution is to separate building (which runs untrusted code) from deploying (which uses secrets):
106+
107+
1. **Build workflow**: Runs on PR events, builds the site, uploads artifact. No secrets.
108+
2. **Deploy workflow**: Triggered by `workflow_run` event after build succeeds. Has access to secrets but only runs trusted action code, not fork code.
109+
110+
For complete workflow examples, see:
111+
112+
- [ipshipyard/ipfs-deploy-action: Dual workflows with fork PRs](https://github.com/ipshipyard/ipfs-deploy-action#dual-workflows-with-fork-prs)
113+
- [ipshipyard/dnslink-action: Dual workflows for secure fork PRs](https://github.com/ipshipyard/dnslink-action#dual-workflows-for-secure-fork-prs)
114+
115+
## Security: Sandboxed DNS Zone
116+
117+
For additional security, use a sandboxed DNS zone to limit what the CI API token can modify. This way, if the token is compromised, attackers can only modify TXT records on a dedicated zone, not your main domain's DNS records (like A, MX, or NS records).
118+
119+
### How it works
120+
121+
Instead of giving CI direct access to your domain's DNS:
122+
123+
1. Create a dedicated zone for DNSLink records (e.g., `dnslinks.example.com`)
124+
2. Create an API token scoped only to that zone
125+
3. On your main domain, add a CNAME record pointing `_dnslink.yourdomain.com` to `_dnslink.yourdomain.dnslinks.example.com`
126+
4. The action updates the TXT record on the sandboxed zone
127+
128+
For detailed setup instructions, see the [ipshipyard/dnslink-action security documentation](https://github.com/ipshipyard/dnslink-action#security-sandboxed-dnslink-domain).
129+
130+
## HTTP Hosting
131+
132+
DNSLink maps a domain name to a CID, so IPFS gateways can serve your content. You also need HTTP hosting for users who access your site directly via `https://yourdomain.com`.
133+
134+
You have two options:
135+
136+
1. **Self-hosted**: Run your own Kubo + Caddy setup that resolves DNSLink and serves content over HTTPS. See [Setup a DNSLink Gateway](./dnslink-gateway.md).
137+
138+
2. **Third-party hosting**: Deploy to [GitHub Pages](https://pages.github.com/), [Cloudflare Pages](https://pages.cloudflare.com/), or [Netlify](https://www.netlify.com/). These handle HTTP hosting independently, while DNSLink provides IPFS access for users with local nodes or gateways.
139+
140+
## Troubleshooting
141+
142+
1. **DNSLink not updating**
143+
- Verify your API token has DNS edit permissions
144+
- Check that `dnslink_domain` matches your DNS setup
145+
- Review the GitHub Actions logs for error messages
146+
147+
2. **DNS propagation delays**
148+
- DNS changes can take time to propagate
149+
- Use `dig` to check the authoritative nameserver directly
150+
151+
3. **CNAME not resolving**
152+
- Ensure the CNAME target includes the full domain name
153+
- Verify both zones are properly configured
154+
155+
## Getting Help
156+
157+
If you encounter issues:
158+
159+
1. Check the GitHub Actions run logs for detailed error messages
160+
2. Review the [ipshipyard/dnslink-action README](https://github.com/ipshipyard/dnslink-action) for updates
161+
3. Open an issue in the [action's repository](https://github.com/ipshipyard/dnslink-action/issues/new)

docs/how-to/websites-on-ipfs/dnslink-gateway.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,13 @@ Your gateway will now automatically serve the content specified in the `_dnslink
185185
186186
## Automate DNSLink Updates
187187
188-
Depending on how you deploy your site, you can automate DNSLink updates using the [DNSLink GitHub Action](https://github.com/ipshipyard/dnslink-action), as part of your CI/CD pipeline, or other DNS management tools like [dnscontrol](https://github.com/StackExchange/dnscontrol) or [octodns](https://github.com/octodns/octodns).
188+
Depending on how you deploy your site, you can automate DNSLink updates using the [DNSLink Action](./dnslink-action.md) as part of your CI/CD pipeline. For a step-by-step guide, see [Automate DNSLink updates with GitHub Actions](./dnslink-action.md).
189+
190+
::: tip Security Best Practice
191+
For production deployments, consider using a [sandboxed DNS zone](./dnslink-action.md#security-sandboxed-dns-zone) to limit what your CI API token can modify. This way, if credentials are compromised, attackers can only modify the DNSLink TXT record, not other DNS records like A, MX, or NS.
192+
:::
193+
194+
You can also use other DNS management tools like [dnscontrol](https://github.com/StackExchange/dnscontrol) or [octodns](https://github.com/octodns/octodns).
189195
190196
## Troubleshooting
191197

0 commit comments

Comments
 (0)