Skip to content

Commit a1af825

Browse files
authored
1.3.0 (#6)
1 parent fb7416d commit a1af825

15 files changed

+428
-767
lines changed

.github/workflows/build.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build Docker image
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
concurrency:
8+
group: build
9+
cancel-in-progress: true
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v2
17+
- name: Set up Docker Buildx
18+
uses: docker/setup-buildx-action@v2
19+
with:
20+
install: true
21+
22+
- name: Build and push
23+
uses: docker/build-push-action@v3
24+
with:
25+
platforms: linux/amd64,linux/arm64
26+
push: false

.github/workflows/docker.yml

+25-17
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
1-
name: ci
1+
name: Publish Docker image
22

33
on:
4-
workflow_dispatch:
5-
push:
6-
tags:
7-
- "v*.*.*"
4+
release:
5+
types: [published]
86

97
jobs:
108
docker:
119
runs-on: ubuntu-latest
1210
steps:
1311
- name: Set up QEMU
14-
uses: docker/setup-qemu-action@v1
12+
uses: docker/setup-qemu-action@v2
1513
- name: Set up Docker Buildx
16-
uses: docker/setup-buildx-action@v1
14+
uses: docker/setup-buildx-action@v2
15+
with:
16+
install: true
17+
1718
- name: Docker Labels
1819
id: meta
19-
uses: crazy-max/ghaction-docker-meta@v2
20+
uses: docker/metadata-action@v4
2021
with:
21-
images: cupcakearmy/ddns-cloudflare
22+
images: |
23+
cupcakearmy/ddns-cloudflare
24+
ghcr.io/${{ github.repository }}
2225
tags: |
2326
type=semver,pattern={{version}}
2427
type=semver,pattern={{major}}.{{minor}}
2528
type=semver,pattern={{major}}
26-
- name: Login to DockerHub
27-
uses: docker/login-action@v1
29+
30+
- name: Log in to Docker Hub
31+
uses: docker/login-action@v2
2832
with:
29-
username: ${{ secrets.DOCKERHUB_USERNAME }}
30-
password: ${{ secrets.DOCKERHUB_TOKEN }}
33+
username: ${{ secrets.DOCKER_USERNAME }}
34+
password: ${{ secrets.DOCKER_TOKEN }}
35+
- name: Log in to the Container registry
36+
uses: docker/login-action@v2
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
3142
- name: Build and push
32-
id: docker_build
33-
uses: docker/build-push-action@v2
43+
uses: docker/build-push-action@v3
3444
with:
3545
platforms: linux/amd64,linux/arm64
3646
push: true
3747
tags: ${{ steps.meta.outputs.tags }}
38-
- name: Image digest
39-
run: echo ${{ steps.docker_build.outputs.digest }}

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.0] - 2022-10-20
9+
10+
### Removed
11+
12+
- Login with username and password as it's considered deprecated.
13+
14+
### Added
15+
16+
- `LOG_LEVEL` env variable.
17+
- Config parsing and validation.
18+
19+
### Changed
20+
21+
- Removed Cloudflare SDK due to outdated and bloated package.
22+
823
## [1.2.1] - 2022-05-14
924

1025
### Added

Dockerfile

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
FROM node:16-alpine as builder
2-
1+
FROM node:18-alpine as base
32
WORKDIR /app
3+
RUN npm -g i pnpm
44

5-
ADD ./package.json ./pnpm-lock.yaml ./
6-
RUN npm exec pnpm install --frozen-lockfile
75

6+
FROM base as builder
7+
ADD ./package.json ./pnpm-lock.yaml ./
8+
RUN pnpm install --frozen-lockfile
89
ADD . .
9-
RUN npm exec pnpm run build
10-
11-
FROM node:16-alpine
12-
13-
WORKDIR /app
10+
RUN pnpm run build
1411

12+
FROM base
1513
ADD ./package.json ./pnpm-lock.yaml ./
16-
RUN npm exec pnpm install --frozen-lockfile --prod
14+
RUN pnpm install --frozen-lockfile --prod
1715
COPY --from=builder /app/dist/ /app/dist/
1816

1917
STOPSIGNAL SIGTERM
2018

21-
CMD ["node", "."]
19+
CMD ["pnpm", "start"]

README.md

+9-13
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ Click create token. You can then use the Edit DNS Zone template. Give it a name.
2020

2121
```bash
2222
TOKEN=mytoken
23-
# Or (Legacy mode)
24-
25-
KEY=Global_API_Key
2623

2724
ZONE=example.org
2825
DNS_RECORD=some.example.org
@@ -48,16 +45,15 @@ docker-compose up -d
4845

4946
## ENV Reference
5047

51-
| Env | Description | Default |
52-
| ------------ | ------------------------------------------------------ | ---------------------- |
53-
| `EMAIL` | [Legacy] E-Mail of the Cloudflare account. | |
54-
| `KEY` | [Legacy] Key for authentication. | |
55-
| `TOKEN` | API Token that can be used instead of `EMAIL` & `KEY`. | |
56-
| `ZONE` | Cloudflare zone where your domain is. | |
57-
| `DNS_RECORD` | The actual DNS record that should be updated. | |
58-
| `PROXIED` | Whether the record is proxied by CloudFlare or not. | |
59-
| `CRON` | Frequency of updates. | \*/5 \* \* \* \* |
60-
| `RESOLVER` | The endpoint used to determine your public ip. | https://api.ipify.org/ |
48+
| Env | Default | Description |
49+
| ------------ | ------------------------ | ----------------------------------------------------------------------------------------------------------- |
50+
| `TOKEN` | | API Token. |
51+
| `ZONE` | | Cloudflare zone where your domain is. |
52+
| `DNS_RECORD` | | The actual DNS record that should be updated. |
53+
| `PROXIED` | `true` | Whether the record is proxied by CloudFlare or not. |
54+
| `CRON` | `*/5 * * * *` | Frequency of updates. |
55+
| `RESOLVER` | `https://api.ipify.org/` | The endpoint used to determine your public ip. |
56+
| `LOG_LEVEL` | `info` | Log level to run at. See [winston](https://github.com/winstonjs/winston#logging-levels) for possible values |
6157

6258
## Customize
6359

package.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
{
2+
"version": "1.3.0",
23
"license": "MIT",
4+
"type": "module",
35
"main": "dist",
46
"scripts": {
5-
"dev": "tsnd src/index.ts",
6-
"build": "tsc"
7+
"dev": "tsc -w",
8+
"build": "tsc",
9+
"start": "node ."
710
},
811
"dependencies": {
9-
"axios": "^0.27.2",
10-
"cloudflare": "^2.9.1",
11-
"cron": "^1.8.2",
12-
"dotenv": "^16.0.1",
13-
"winston": "^3.7.2"
12+
"axios": "^1.1.3",
13+
"dotenv": "^16.0.3",
14+
"node-cron": "^3.0.2",
15+
"winston": "^3.8.2"
1416
},
1517
"devDependencies": {
16-
"@types/cloudflare": "^2.7.8",
17-
"@types/cron": "^1.7.3",
18-
"ts-node-dev": "^1.1.8",
19-
"typescript": "^4.6.4"
18+
"@types/node": "18",
19+
"@types/node-cron": "^3.0.4",
20+
"typescript": "^4.8.4"
2021
}
2122
}

0 commit comments

Comments
 (0)