Skip to content

Commit

Permalink
build: bump mod, lib, & data (#5)
Browse files Browse the repository at this point in the history
* build: bump mod & `github.com/domainr/whois`

Signed-off-by: Dwi Siswanto <git@dw1.io>

* ci: refactor update DB workflow

Signed-off-by: Dwi Siswanto <git@dw1.io>

* db: Update DB (2024040700) (#4)

Co-authored-by: dwisiswant0 <dwisiswant0@users.noreply.github.com>

* docs: update installation prereqs

Signed-off-by: Dwi Siswanto <git@dw1.io>

* ci: update release workflow

Signed-off-by: Dwi Siswanto <git@dw1.io>

* ci: remove build workflow

Signed-off-by: Dwi Siswanto <git@dw1.io>

---------

Signed-off-by: Dwi Siswanto <git@dw1.io>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dwisiswant0 <dwisiswant0@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 8, 2024
1 parent 226387f commit 409bb73
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 112 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/build.yaml

This file was deleted.

34 changes: 14 additions & 20 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
name: Release

on:
create:
push:
tags:
- v*
- "v*"

jobs:
release:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: "Check out code"
uses: actions/checkout@v2
with:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Set up Go"
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: "Create release on GitHub"
uses: goreleaser/goreleaser-action@v2
with:
args: "release --rm-dist"
- uses: teler-sh/actions/setup-go@v1
- uses: goreleaser/goreleaser-action@v5
with:
version: latest
env:
GITHUB_TOKEN: "${{ secrets.RELEASE_TOKEN }}"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 25 additions & 17 deletions .github/workflows/update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,50 @@ on:
- cron: "0 0 * * 0" # at 00:00 on Sunday
workflow_dispatch:

env:
DB_PATH: db/tlds.txt

jobs:
update:
runs-on: ubuntu-latest
steps:
- name: "Install dependencies"
run: sudo apt install curl -y

- name: "Check out code"
uses: actions/checkout@v4

- name: "Check for updates"
id: check
run: |
if [[ "$(curl -skL ${{ secrets.LOCAL_DB }} | wc -l)" == "$(curl -skL ${{ secrets.REMOTE_DB }} | wc -l)" ]]; then
echo "::set-output name=isUpdated::true"
else
echo "::set-output name=isUpdated::false"
fi
local_ver="$(grep -oP '^# Version \K\d+' ${{ env.DB_PATH }})"
remote_ver="$(curl -sr 0-20 ${{ secrets.REMOTE_DB }} | grep -oP '^# Version \K\d+')"
echo "::set-output name=date::$(date)"
echo -e "Date: $(date)"
echo -e "Local version: ${local_ver}"
echo -e "Remote version: ${remote_ver}"
- name: "Check out code"
if: steps.check.isUpdated == 'false'
uses: actions/checkout@v2
with:
fetch-depth: 0
if [[ "${local_ver}" -lt "${remote_ver}" ]]; then
echo "isUpdated=false" >> $GITHUB_OUTPUT
else
echo "isUpdated=true" >> $GITHUB_OUTPUT
fi
echo "remoteVersion=${remote_ver}" >> $GITHUB_OUTPUT
- name: "Update DB..."
if: steps.check.isUpdated == 'false'
run: curl -kLo db/tlds.txt ${{ secrets.REMOTE_DB }}
if: steps.check.outputs.isUpdated == 'false'
run: curl -kLo ${{ env.DB_PATH }} ${{ secrets.REMOTE_DB }}

- name: Create Pull Request
if: steps.check.isUpdated == 'false'
if: steps.check.outputs.isUpdated == 'false'
uses: peter-evans/create-pull-request@v3
with:
body: "Automated update TLDs data."
branch-suffix: "short-commit-hash"
branch: "update/db"
commit-message: "db: Update DB ${{ steps.check.date }}"
committer: "Dwi Siswanto <me@dw1.io>"
commit-message: "db: Update DB (${{ steps.check.outputs.remoteVersion }})"
committer: "ghost <ghost@users.noreply.github.com>"
delete-branch: true
reviewers: "dwisiswant0"
title: "db: Update DB ${{ steps.check.date }}"
title: "db: Update DB (${{ steps.check.outputs.remoteVersion }})"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ TLDs finder — check domain name availability across all valid top-level domain
## Installation

- Get pre-built binary from [releases page](https://github.com/dwisiswant0/tlder/releases), or
- If you have [Go1.17+](https://go.dev/dl/) compiler installed & configured: `go install github.com/dwisiswant0/tlder@latest`.
- If you have [Go1.19+](https://go.dev/dl/) compiler installed & configured: `go install github.com/dwisiswant0/tlder@latest`.

## Usage

Expand Down

0 comments on commit 409bb73

Please sign in to comment.