97 lines
4.1 KiB
Markdown
97 lines
4.1 KiB
Markdown
<p align="center"><img src="assets/logo.png" alt="Interweb" width="280"></p>
|
|
|
|
# Interweb Angola DNS update
|
|
|
|
<!-- badges:start -->
|
|
[](https://git.interweb.ao/interweb-ao/dns-update-action/releases) [](LICENSE)
|
|
<!-- badges:end -->
|
|
|
|
A GitHub Action that creates, changes or deletes DNS records of your Interweb Angola domain through the API. Use it to point a name to a new server after a deploy, to add a verification TXT, or to keep the zone in a repository.
|
|
|
|
[Português](README-pt.md)
|
|
|
|
## Before you start
|
|
|
|
Create an API key in the [API Center](https://www.meu.interweb.ao/api-center.php) of Meu Interweb with the `dns:read` and `dns:write` permissions, and save it in your repository as the secret `INTERWEB_API_KEY`. The domain must be active on your account with DNS on.
|
|
|
|
## Example
|
|
|
|
`.github/workflows/dns.yml`:
|
|
|
|
```yaml
|
|
name: DNS
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
dns:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Point www to the new server
|
|
uses: interweb-ao/dns-update-action@v1
|
|
with:
|
|
api-key: ${{ secrets.INTERWEB_API_KEY }}
|
|
domain: example.co.ao
|
|
type: A
|
|
name: www
|
|
value: 203.0.113.10
|
|
ttl: 3600
|
|
```
|
|
|
|
Several records in one step, as JSON:
|
|
|
|
```yaml
|
|
- uses: interweb-ao/dns-update-action@v1
|
|
with:
|
|
api-key: ${{ secrets.INTERWEB_API_KEY }}
|
|
domain: example.co.ao
|
|
records: |
|
|
[
|
|
{"type": "A", "name": "@", "value": "203.0.113.10"},
|
|
{"type": "CNAME", "name": "blog", "value": "example.co.ao"},
|
|
{"type": "TXT", "name": "@", "value": "site-verification=abc123"},
|
|
{"action": "delete", "type": "A", "name": "old"}
|
|
]
|
|
```
|
|
|
|
## What each action does
|
|
|
|
- **upsert** (default): if the record already exists as asked, nothing changes. On A, AAAA and CNAME, a single record with the same name and type gets the new value. On MX, TXT, NS, SRV and CAA, a new value is added next to the others (an SPF and a verification code can live together). To change one of several records, give its current value in `match-value`.
|
|
- **create**: always adds, unless the same record is already there.
|
|
- **delete**: deletes the records with that name and type. With `value`, only the ones with that value. If there is nothing to delete, the step still passes.
|
|
|
|
## Inputs
|
|
|
|
| Input | Default | What it does |
|
|
|---|---|---|
|
|
| `api-key` | | API key with `dns:read` and `dns:write`. Empty uses the `INTERWEB_API_KEY` environment variable. |
|
|
| `domain` | | The domain (required). |
|
|
| `action` | `upsert` | `upsert`, `create` or `delete`. |
|
|
| `type` | | `A`, `AAAA`, `CNAME`, `MX`, `TXT`, `NS`, `SRV` or `CAA`. |
|
|
| `name` | `@` | Record name, such as `www`. `@` is the domain itself. The full name also works. |
|
|
| `value` | | Record value. SRV: `weight port target`. CAA: `tag value`. |
|
|
| `ttl` | | 60 to 604800 seconds. Empty keeps the current one, or 14400 on a new record. |
|
|
| `priority` | | For MX and SRV. On CAA it is the flag. |
|
|
| `match-value` | | Current value of the record to change, when there are several. |
|
|
| `records` | | Several records as a JSON list. When set, the inputs above are ignored. |
|
|
| `dry-run` | `false` | Show what would change, without changing. |
|
|
|
|
Outputs: `changed` (`true` when something changed, or would change in a dry run), `record-ids` and `simulated`.
|
|
|
|
## Good to know
|
|
|
|
- A copy of the zone is kept before each change, and you can go back to it through the API.
|
|
- With a `sandbox_` key the changes are simulated: a safe way to try your workflow.
|
|
- Read-only records, such as the NS records of the domain itself, are never touched. Nameservers are changed in the domain settings.
|
|
- The MX records of the domain of the account email cannot be changed through the API. Change them in Meu Interweb.
|
|
- Changes are limited to 20 per minute per account. Only the Python 3 already on the runner is used.
|
|
- The API docs for DNS: https://docs.interweb.ao/dns/
|
|
|
|
## License
|
|
|
|
MIT. See [LICENSE](LICENSE).
|
|
|
|
---
|
|
|
|
Maintained by RLX Holdings.
|