diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index 1209a55..bda6d4f 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -46,6 +46,11 @@ jobs: run: | VERSION=${{ github.ref_name }} ./build.sh + - name: Build tarball for each platform + if: startsWith(github.ref, 'refs/tags/v') + run: | + VERSION=${{ github.ref_name }} ./package.sh + - name: Build binary without tag if: ${{ ! startsWith(github.ref, 'refs/tags/v') }} run: | @@ -99,7 +104,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') run: | gh release create ${{ github.ref_name }} \ - -F docs/notes/release-${{ github.ref_name }}.md - output/*.tar.gz* + -F docs/notes/release-${{ github.ref_name }}.md \ + output/* env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfbab48..4351b9c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,8 +14,8 @@ Please include a short and precise description about what you have done in the c We strongly recommend use GPG to sign your commit, and add a sign-off message after your commit message. We enabled vigilant mode so we can make sure that all commits are committed by yourself. -``` -$ git commit -s -S -m "what-i-have-done" +```bash +git commit -s -S -m "what-i-have-done" ``` For now we don't force contributors to sign their commits, but in the future we might refuse Pull Requests that commits are not signed. @@ -25,7 +25,8 @@ For now we don't force contributors to sign their commits, but in the future we 1. We indent using Tab, you can choose any tab size you want when you browsing or writing code, but always choose Tab for indent; 2. All Go source files must add an Apache 2.0 license header comment, you can add your name and email under `Contributors` section like this: -``` + +```plaintext /* Copyright © 2024 masteryyh @@ -37,7 +38,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -59,43 +60,43 @@ limitations under the License. 3. How to generate or use your existing GPG key: - - [Generating a new GPG key](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key) - - - [Checking for existing GPG keys](https://docs.github.com/en/authentication/managing-commit-signature-verification/checking-for-existing-gpg-keys) +- [Generating a new GPG key](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key) + +- [Checking for existing GPG keys](https://docs.github.com/en/authentication/managing-commit-signature-verification/checking-for-existing-gpg-keys) - - [Adding a GPG key to your GitHub account](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account) +- [Adding a GPG key to your GitHub account](https://docs.github.com/en/authentication/managing-commit-signature-verification/adding-a-gpg-key-to-your-github-account) - - [Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key) +- [Telling Git about your signing key](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key) - - [Signing commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) +- [Signing commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) ### DNS provider documentations - AliCloud: - - API: https://www.alibabacloud.com/help/en/dns/api-alidns-2015-01-09-overview - - SDK: https://next.api.aliyun.com/api-tools/sdk/Alidns?version=2015-01-09&language=java-async-tea&tab=primer-doc + - API: + - SDK: - Cloudflare: - - API: https://developers.cloudflare.com/api/ - - SDK: https://developers.cloudflare.com/fundamentals/api/reference/sdks/ + - API: + - SDK: - DNSPod: - - API: https://cloud.tencent.com/document/api/1427/56194 - - SDK: https://cloud.tencent.com/document/sdk/Go + - API: + - SDK: - HuaweiCloud: - - API: https://console.huaweicloud.com/apiexplorer/#/openapi/DNS/doc - - SDK: https://console.huaweicloud.com/apiexplorer/#/sdkcenter/DNS?lang=Go + - API: + - SDK: - JDCloud: - - API: https://docs.jdcloud.com/cn/jd-cloud-dns/api/introduction - - SDK: https://docs.jdcloud.com/cn/sdk/go + - API: + - SDK: - RFC2136: - As RFC2136 is actually a standard, not a DNS provider, we can only provide IETF documentation about this: https://datatracker.ietf.org/doc/html/rfc2136 \ No newline at end of file + As RFC2136 is actually a standard, not a DNS provider, we can only provide IETF documentation about this: diff --git a/README.md b/README.md index c9463a7..21a4526 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -## micro-ddns +# micro-ddns + micro-ddns is a tool that can update your DNS record dynamically based on current IP address, support multiple IP address detection methods and DNS providers. ## Quick Start + ```yaml # /etc/micro-ddns/config.yaml ddns: @@ -26,17 +28,18 @@ provider: apiToken: "" ``` -``` -$ micro-ddns run --config /etc/micro-ddns/config.yaml +```bash +micro-ddns run --config /etc/micro-ddns/config.yaml ``` OR you can run as a container: -``` -$ docker run --name ddns -d -v /path/to/config.yaml:/etc/micro-ddns/config.yaml masteryyh/micro-ddns:alpine +```bash +docker run --name ddns -d -v /path/to/config.yaml:/etc/micro-ddns/config.yaml masteryyh/micro-ddns:alpine ``` ## License + This project is licensed under the Apache License 2.0. For more details, see the LICENSE file in the repository. Copyright (c) 2024 masteryyh diff --git a/docs/notes/release-v0.0.1.md b/docs/notes/release-v0.0.1.md new file mode 100644 index 0000000..263f1ff --- /dev/null +++ b/docs/notes/release-v0.0.1.md @@ -0,0 +1,22 @@ +# micro-ddns v0.0.1 Release Notes + +This is the first release of micro-ddns! + +## Supported DNS Providers + +- [x] [Cloudflare](https://www.cloudflare.com/) +- [x] [AliCloud](https://www.aliyun.com/) +- [x] [DNSPod](https://www.dnspod.cn/) +- [x] [HuaweiCloud](https://www.huaweicloud.com/) +- [x] [JDCloud](https://www.jdcloud.com/) +- [x] [RFC2136 (experimental)](https://datatracker.ietf.org/doc/html/rfc2136) + +## Supported Address Detection Methods + +- [x] Interface +- [x] 3rd Party API +- [x] SSH + +## Known Issues + +- When using AliCloud DNS provider, you may encounter the following error: "You can’t finish this operation because the last operation has not been finished". You can try to wait for next DNS update and its not always reproducible. diff --git a/internal/cli/root.go b/internal/cli/root.go index f8ef428..86b9b8e 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -33,8 +33,7 @@ var ( Short: "A simple tool to update DNS dynamically", Long: `A simple tool to update DNS dynamically if you want to create DNS records for hosts that IP address might changes. Support multiple DNS providers. - -Still under construction. ;)`, +`, } ) diff --git a/package.sh b/package.sh old mode 100644 new mode 100755 index b2b3546..89343a4 --- a/package.sh +++ b/package.sh @@ -8,9 +8,9 @@ create_package() { local version=$3 echo "Packing for OS $os and arch $arch..." - local path="output/$os/$arch" + local path="output/micro-ddns-$os-$arch" if [ ! -d "$path" ]; then - mkdir -p "output/$os/$arch" + mkdir -p "$path" fi local binary="bin/micro-ddns-${os}-${arch}" @@ -33,7 +33,7 @@ create_package() { fi local tar_name="output/micro-ddns-${os}-${arch}-$version.tar.gz" - tar -czf "$tar_name" "output/$os/$arch" + tar -czf "$tar_name" -C "$path" . sha256sum "$tar_name" > "$tar_name.sha256" } @@ -53,3 +53,5 @@ do create_package "${os_arch[0]}" "${os_arch[1]}" "$VERSION" & done wait + +rm -rf output/*/