Skip to content

Commit 3274de1

Browse files
committed
feat: initial public release
1 parent 8543f48 commit 3274de1

30 files changed

Lines changed: 2780 additions & 0 deletions

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
.gitignore
3+
README.md
4+
*.md
5+
.DS_Store
6+
Thumbs.db
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Bug Report
2+
description: File a bug report
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
11+
- type: textarea
12+
id: what-happened
13+
attributes:
14+
label: What happened?
15+
description: Also tell us, what did you expect to happen?
16+
placeholder: Tell us what you see!
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
id: reproduce
22+
attributes:
23+
label: Steps to reproduce
24+
description: How can we reproduce this issue?
25+
placeholder: |
26+
1. Go to '...'
27+
2. Click on '....'
28+
3. See error
29+
validations:
30+
required: true
31+
32+
- type: textarea
33+
id: logs
34+
attributes:
35+
label: Relevant log output
36+
description: Please copy and paste any relevant log output. This can be from the browser console.
37+
render: shell

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Documentation
4+
url: https://github.com/techquestsdev/hashpad#readme
5+
about: Check the README for usage instructions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Feature Request
2+
description: Suggest an idea for this project
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to suggest a feature!
10+
11+
- type: textarea
12+
id: problem
13+
attributes:
14+
label: Is your feature request related to a problem?
15+
description: A clear and concise description of what the problem is.
16+
placeholder: I'm always frustrated when...
17+
validations:
18+
required: false
19+
20+
- type: textarea
21+
id: solution
22+
attributes:
23+
label: Describe the solution you'd like
24+
description: A clear and concise description of what you want to happen.
25+
validations:
26+
required: true
27+
28+
- type: textarea
29+
id: alternatives
30+
attributes:
31+
label: Describe alternatives you've considered
32+
description: A clear and concise description of any alternative solutions or features you've considered.
33+
validations:
34+
required: false

.github/dependabot.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "docker"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
commit-message:
8+
prefix: "deps"
9+
labels:
10+
- "dependencies"
11+
- "docker"
12+
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"
17+
commit-message:
18+
prefix: "ci"
19+
labels:
20+
- "dependencies"
21+
- "github-actions"

.github/pull_request_template.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Description
2+
3+
<!-- Describe your changes in detail -->
4+
5+
## Type of Change
6+
7+
- [ ] Bug fix (non-breaking change which fixes an issue)
8+
- [ ] New feature (non-breaking change which adds functionality)
9+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10+
- [ ] Documentation update
11+
- [ ] CI/CD changes
12+
13+
## Related Issues
14+
15+
<!-- Link any related issues here using #issue-number -->
16+
17+
## Testing
18+
19+
- [ ] I have tested these changes locally
20+
- [ ] I have added tests that prove my fix is effective or that my feature works
21+
- [ ] All existing tests pass
22+
23+
## Checklist
24+
25+
- [ ] My code follows the project's style guidelines
26+
- [ ] I have performed a self-review of my code
27+
- [ ] I have commented my code, particularly in hard-to-understand areas
28+
- [ ] I have made corresponding changes to the documentation (if applicable)

.github/workflows/ci.yml

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
packages: write
13+
id-token: write
14+
security-events: write
15+
attestations: write
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }}
20+
21+
env:
22+
REGISTRY: ghcr.io
23+
IMAGE_NAME: ${{ github.repository }}
24+
25+
jobs:
26+
semantic-version:
27+
runs-on: ubuntu-latest
28+
if: github.event_name == 'push'
29+
outputs:
30+
new_tag: ${{ steps.tag.outputs.new_tag }}
31+
changelog: ${{ steps.tag.outputs.changelog }}
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v6
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Get latest tag
39+
id: get_tag
40+
run: |
41+
# Get the latest tag, or default to v0.0.0
42+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
43+
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
44+
echo "Latest tag: $LATEST_TAG"
45+
46+
- name: Determine version bump
47+
id: bump
48+
run: |
49+
# Get the commit message
50+
COMMIT_MSG=$(git log -1 --pretty=%B)
51+
echo "Commit message: $COMMIT_MSG"
52+
53+
# Determine bump type based on conventional commits
54+
if echo "$COMMIT_MSG" | grep -qiE '^(feat|fix|perf|refactor|style|test|docs|chore)!:' || echo "$COMMIT_MSG" | grep -qi 'BREAKING CHANGE'; then
55+
BUMP_TYPE="major"
56+
elif echo "$COMMIT_MSG" | grep -qiE '^feat(\(.+\))?:'; then
57+
BUMP_TYPE="minor"
58+
elif echo "$COMMIT_MSG" | grep -qiE '^(fix|perf)(\(.+\))?:'; then
59+
BUMP_TYPE="patch"
60+
else
61+
BUMP_TYPE="none"
62+
fi
63+
64+
echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT
65+
echo "Bump type: $BUMP_TYPE"
66+
67+
- name: Calculate new version
68+
id: tag
69+
run: |
70+
# Only version on main branch pushes
71+
if [ "${GITHUB_REF}" != "refs/heads/main" ]; then
72+
echo "Not on main; skipping versioning"
73+
echo "new_tag=" >> $GITHUB_OUTPUT
74+
echo "changelog=" >> $GITHUB_OUTPUT
75+
exit 0
76+
fi
77+
78+
LATEST_TAG="${{ steps.get_tag.outputs.latest_tag }}"
79+
BUMP_TYPE="${{ steps.bump.outputs.bump_type }}"
80+
81+
if [ "$BUMP_TYPE" = "none" ]; then
82+
echo "No semantic commit detected, skipping versioning"
83+
echo "new_tag=" >> $GITHUB_OUTPUT
84+
echo "changelog=" >> $GITHUB_OUTPUT
85+
exit 0
86+
fi
87+
88+
# Remove 'v' prefix and split version
89+
VERSION=${LATEST_TAG#v}
90+
IFS='.' read -r -a VERSION_PARTS <<< "$VERSION"
91+
MAJOR=${VERSION_PARTS[0]:-0}
92+
MINOR=${VERSION_PARTS[1]:-0}
93+
PATCH=${VERSION_PARTS[2]:-0}
94+
95+
# Bump version based on type
96+
case $BUMP_TYPE in
97+
major)
98+
MAJOR=$((MAJOR + 1))
99+
MINOR=0
100+
PATCH=0
101+
;;
102+
minor)
103+
MINOR=$((MINOR + 1))
104+
PATCH=0
105+
;;
106+
patch)
107+
PATCH=$((PATCH + 1))
108+
;;
109+
esac
110+
111+
NEW_TAG="v${MAJOR}.${MINOR}.${PATCH}"
112+
echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT
113+
echo "New tag: $NEW_TAG"
114+
115+
# Get commit message for changelog
116+
COMMIT_MSG=$(git log -1 --pretty=%B)
117+
echo "changelog=$COMMIT_MSG" >> $GITHUB_OUTPUT
118+
119+
- name: Create and push tag
120+
if: steps.tag.outputs.new_tag != ''
121+
run: |
122+
NEW_TAG="${{ steps.tag.outputs.new_tag }}"
123+
git config user.name "github-actions[bot]"
124+
git config user.email "github-actions[bot]@users.noreply.github.com"
125+
git tag -a "$NEW_TAG" -m "Release $NEW_TAG"
126+
git push origin "$NEW_TAG"
127+
echo "✓ Created and pushed tag: $NEW_TAG"
128+
129+
build-and-push:
130+
runs-on: ubuntu-latest
131+
needs: [semantic-version]
132+
if: github.event_name != 'pull_request'
133+
steps:
134+
- name: Checkout code
135+
uses: actions/checkout@v6
136+
137+
- name: Set up Docker Buildx
138+
uses: docker/setup-buildx-action@v3
139+
140+
- name: Log in to Container Registry
141+
uses: docker/login-action@v3
142+
with:
143+
registry: ${{ env.REGISTRY }}
144+
username: ${{ github.actor }}
145+
password: ${{ secrets.GITHUB_TOKEN }}
146+
147+
- name: Extract metadata
148+
id: meta
149+
uses: docker/metadata-action@v5
150+
with:
151+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
152+
tags: |
153+
type=ref,event=branch
154+
type=semver,pattern={{version}}
155+
type=sha,prefix={{branch}}-,enable={{is_default_branch}}
156+
type=raw,value=latest,enable={{is_default_branch}}
157+
type=raw,value=${{ needs.semantic-version.outputs.new_tag }},enable=${{ needs.semantic-version.outputs.new_tag != '' }}
158+
159+
- name: Build and push Docker image
160+
id: build
161+
uses: docker/build-push-action@v6
162+
with:
163+
context: .
164+
platforms: linux/amd64,linux/arm64
165+
push: true
166+
tags: ${{ steps.meta.outputs.tags }}
167+
labels: ${{ steps.meta.outputs.labels }}
168+
cache-from: type=gha
169+
cache-to: type=gha,mode=max
170+
provenance: true
171+
sbom: true
172+
173+
- name: Generate artifact attestation
174+
uses: actions/attest-build-provenance@v3
175+
with:
176+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
177+
subject-digest: ${{ steps.build.outputs.digest }}
178+
push-to-registry: true
179+
180+
- name: Run Trivy vulnerability scanner (SARIF)
181+
uses: aquasecurity/trivy-action@master
182+
with:
183+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
184+
format: "sarif"
185+
output: "trivy-results.sarif"
186+
severity: "CRITICAL,HIGH"
187+
188+
- name: Upload Trivy results to GitHub Security
189+
uses: github/codeql-action/upload-sarif@v4
190+
if: always()
191+
with:
192+
sarif_file: "trivy-results.sarif"
193+
194+
- name: Run Trivy vulnerability scanner (table)
195+
uses: aquasecurity/trivy-action@master
196+
with:
197+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
198+
format: "table"
199+
severity: "CRITICAL,HIGH"
200+
201+
validate-docker:
202+
runs-on: ubuntu-latest
203+
if: github.event_name == 'pull_request'
204+
steps:
205+
- name: Checkout code
206+
uses: actions/checkout@v6
207+
208+
- name: Set up Docker Buildx
209+
uses: docker/setup-buildx-action@v3
210+
211+
- name: Build Docker image (validation only)
212+
id: build
213+
uses: docker/build-push-action@v6
214+
with:
215+
context: .
216+
push: false
217+
load: true
218+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}
219+
cache-from: type=gha
220+
cache-to: type=gha,mode=max
221+
222+
- name: Run Trivy vulnerability scanner on PR
223+
uses: aquasecurity/trivy-action@master
224+
with:
225+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.pull_request.number }}
226+
format: "table"
227+
severity: "CRITICAL,HIGH"
228+
exit-code: "1"
229+
230+
create-release:
231+
runs-on: ubuntu-latest
232+
needs: [semantic-version, build-and-push]
233+
if: |
234+
github.event_name == 'push' &&
235+
github.ref == 'refs/heads/main' &&
236+
needs.semantic-version.outputs.new_tag != ''
237+
steps:
238+
- name: Checkout code
239+
uses: actions/checkout@v6
240+
241+
- name: Create GitHub Release
242+
uses: softprops/action-gh-release@v2
243+
with:
244+
tag_name: ${{ needs.semantic-version.outputs.new_tag }}
245+
name: Release ${{ needs.semantic-version.outputs.new_tag }}
246+
body: |
247+
## Changes
248+
${{ needs.semantic-version.outputs.changelog }}
249+
250+
## Docker Image
251+
```bash
252+
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.semantic-version.outputs.new_tag }}
253+
```
254+
## What's Changed
255+
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ needs.semantic-version.outputs.new_tag }}...main
256+
draft: false
257+
prerelease: false
258+
generate_release_notes: true

0 commit comments

Comments
 (0)