Skip to content

Commit bd50e12

Browse files
committed
init
Signed-off-by: Rez Moss <hi@rezmoss.com>
1 parent ce6cc55 commit bd50e12

28 files changed

+60650
-1
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
go-version: ['1.21', '1.22', '1.23']
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: ${{ matrix.go-version }}
24+
25+
- name: Build
26+
run: go build ./...
27+
28+
- name: Test
29+
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
30+
31+
- name: Upload coverage
32+
uses: codecov/codecov-action@v4
33+
if: matrix.go-version == '1.22'
34+
with:
35+
files: coverage.txt
36+
fail_ci_if_error: false

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.21'
24+
25+
- name: Run tests before release
26+
run: go test -v ./...
27+
28+
- name: Run GoReleaser
29+
uses: goreleaser/goreleaser-action@v6
30+
with:
31+
distribution: goreleaser
32+
version: '~> v2'
33+
args: release --clean
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/update-data.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Update Disposable Email Data
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * *' # Daily at 2 AM UTC
6+
workflow_dispatch: # Manual trigger
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
update:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: '1.21'
22+
23+
- name: Save old checksum
24+
id: old_checksum
25+
run: |
26+
if [ -f data/data.bin ]; then
27+
echo "checksum=$(sha256sum data/data.bin | cut -d' ' -f1)" >> $GITHUB_OUTPUT
28+
else
29+
echo "checksum=none" >> $GITHUB_OUTPUT
30+
fi
31+
32+
- name: Update data
33+
run: go run ./cmd/disposable-update -o ./data -v -summary /tmp/update-summary.txt
34+
35+
- name: Check for changes
36+
id: check
37+
run: |
38+
NEW_CHECKSUM=$(sha256sum data/data.bin | cut -d' ' -f1)
39+
OLD_CHECKSUM="${{ steps.old_checksum.outputs.checksum }}"
40+
41+
if [ "$NEW_CHECKSUM" = "$OLD_CHECKSUM" ]; then
42+
echo "No changes detected in data.bin (checksum unchanged)"
43+
echo "changed=false" >> $GITHUB_OUTPUT
44+
else
45+
echo "Changes detected in data.bin"
46+
echo "Old checksum: $OLD_CHECKSUM"
47+
echo "New checksum: $NEW_CHECKSUM"
48+
echo "changed=true" >> $GITHUB_OUTPUT
49+
# Read summary for commit message
50+
if [ -f /tmp/update-summary.txt ]; then
51+
SUMMARY=$(cat /tmp/update-summary.txt)
52+
echo "summary=$SUMMARY" >> $GITHUB_OUTPUT
53+
else
54+
echo "summary=data updated" >> $GITHUB_OUTPUT
55+
fi
56+
fi
57+
58+
- name: Commit and push changes
59+
if: steps.check.outputs.changed == 'true'
60+
run: |
61+
git config user.name "github-actions[bot]"
62+
git config user.email "github-actions[bot]@users.noreply.github.com"
63+
git add data/data.bin
64+
git commit -m "chore: daily update - ${{ steps.check.outputs.summary }}"
65+
git push
66+
67+
- name: Skip notification
68+
if: steps.check.outputs.changed == 'false'
69+
run: echo "No changes to commit - data.bin is already up to date"

.goreleaser.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# GoReleaser configuration for go-is-disposable-email
2+
# This is a Go library, not a CLI tool, so we don't build binaries
3+
# We only create releases with source code and data.bin
4+
5+
version: 2
6+
7+
# Skip binary builds - this is a library
8+
builds:
9+
- skip: true
10+
11+
# Include data.bin in the release assets
12+
extra_files:
13+
- glob: data/data.bin
14+
15+
# Release configuration
16+
release:
17+
github:
18+
owner: rezmoss
19+
name: go-is-disposable-email
20+
21+
# Release name template
22+
name_template: "v{{.Version}}"
23+
24+
# Release notes
25+
header: |
26+
## go-is-disposable-email v{{.Version}}
27+
28+
A Go package for detecting disposable/temporary email addresses.
29+
30+
### Installation
31+
32+
```bash
33+
go get github.com/rezmoss/go-is-disposable-email@v{{.Version}}
34+
```
35+
36+
### Data File
37+
38+
The `data.bin` file is included in this release. It will be automatically downloaded when you first use the package.
39+
40+
footer: |
41+
---
42+
43+
**Full Changelog**: https://github.com/rezmoss/go-is-disposable-email/compare/{{.PreviousTag}}...{{.Tag}}
44+
45+
# Don't mark as prerelease
46+
prerelease: auto
47+
48+
# Draft mode (set to false for auto-publish)
49+
draft: false
50+
51+
# Changelog configuration
52+
changelog:
53+
sort: asc
54+
use: github
55+
filters:
56+
exclude:
57+
- '^docs:'
58+
- '^test:'
59+
- '^chore:'
60+
- Merge pull request
61+
- Merge branch
62+
groups:
63+
- title: Features
64+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
65+
order: 0
66+
- title: Bug Fixes
67+
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
68+
order: 1
69+
- title: Performance
70+
regexp: '^.*?perf(\([[:word:]]+\))??!?:.+$'
71+
order: 2
72+
- title: Other
73+
order: 999
74+
75+
# Source archive configuration
76+
source:
77+
enabled: true
78+
name_template: "{{ .ProjectName }}-{{ .Version }}-source"
79+
80+
# Checksum configuration
81+
checksum:
82+
name_template: 'checksums.txt'
83+
algorithm: sha256

0 commit comments

Comments
 (0)