Skip to content

Commit 7801bab

Browse files
authored
πŸš€ release: v1.0.0-beta.2 - Merge pull request #4 from wgtechlabs/dev
2 parents a950160 + dfb9c56 commit 7801bab

File tree

10 files changed

+466
-3
lines changed

10 files changed

+466
-3
lines changed

β€Ž.dockerignoreβ€Ž

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Build output
8+
dist/
9+
build/
10+
11+
# Git
12+
.git/
13+
.gitignore
14+
15+
# Environment files
16+
.env
17+
.env.*
18+
!.env.example
19+
20+
# IDE and editor files
21+
.vscode/
22+
.idea/
23+
*.swp
24+
*.swo
25+
26+
# OS generated files
27+
.DS_Store
28+
.DS_Store?
29+
._*
30+
.Spotlight-V100
31+
.Trashes
32+
ehthumbs.db
33+
Thumbs.db
34+
35+
# Logs
36+
logs/
37+
*.log
38+
39+
# Runtime data
40+
pids/
41+
*.pid
42+
*.seed
43+
*.pid.lock
44+
45+
# Coverage directory
46+
coverage/
47+
*.lcov
48+
49+
# Temporary folders
50+
tmp/
51+
temp/
52+
53+
# Documentation
54+
docs/
55+
ai_context/
56+
README.md
57+
CONTRIBUTING.md
58+
CODE_OF_CONDUCT.md
59+
LICENSE
60+
SECURITY.md
61+
62+
# Package manager files
63+
package-lock.json
64+
.yarn-integrity
65+
.yarn/
66+
67+
# TypeScript
68+
*.tsbuildinfo
69+
70+
# Cache
71+
.cache/
72+
.parcel-cache/
73+
.eslintcache
74+
.rpt2_cache/
75+
.rts2_cache_cjs/
76+
.rts2_cache_es/
77+
.rts2_cache_umd/
78+
79+
# Testing
80+
test/
81+
tests/
82+
__tests__/

β€Ž.env.exampleβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
NODE_ENV=development
22
PORT=3000
3-
TARGET_PLATFORM=telegram
3+
# For local development use: redis://localhost:6379
4+
# For Docker Compose, this gets overridden automatically to: redis://redis:6379
45
REDIS_URL=redis://localhost:6379
5-
UNTHREAD_WEBHOOK_SECRET=your_signing_secret_here
6+
TARGET_PLATFORM=telegram
7+
UNTHREAD_WEBHOOK_SECRET=your_webhook_secret_here

β€Ž.github/workflows/build.ymlβ€Ž

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [dev]
6+
7+
env:
8+
REGISTRY_DOCKERHUB: wgtechlabs/unthread-webhook-server
9+
REGISTRY_GHCR: ghcr.io/wgtechlabs/unthread-webhook-server
10+
11+
jobs:
12+
build-dev:
13+
name: Build Development Images
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Login to Docker Hub
24+
uses: docker/login-action@v3
25+
with:
26+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
27+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata
37+
id: meta
38+
run: |
39+
echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
40+
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
41+
42+
- name: Build and push development images
43+
uses: docker/build-push-action@v5
44+
with:
45+
context: .
46+
push: true
47+
platforms: linux/amd64
48+
tags: |
49+
${{ env.REGISTRY_DOCKERHUB }}:dev
50+
${{ env.REGISTRY_DOCKERHUB }}:dev-${{ steps.meta.outputs.short_sha }}
51+
${{ env.REGISTRY_GHCR }}:dev
52+
${{ env.REGISTRY_GHCR }}:dev-${{ steps.meta.outputs.short_sha }}
53+
labels: |
54+
org.opencontainers.image.title=Unthread Webhook Server
55+
org.opencontainers.image.description=Development build of Unthread Webhook Server
56+
org.opencontainers.image.version=dev-${{ steps.meta.outputs.short_sha }}
57+
org.opencontainers.image.created=${{ steps.meta.outputs.build_date }}
58+
org.opencontainers.image.revision=${{ github.sha }}
59+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
60+
cache-from: type=gha
61+
cache-to: type=gha,mode=max
62+
63+
- name: Development build summary
64+
run: |
65+
echo "## πŸ”¨ Development Build Complete" >> $GITHUB_STEP_SUMMARY
66+
echo "**Images built and pushed:**" >> $GITHUB_STEP_SUMMARY
67+
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:dev\`" >> $GITHUB_STEP_SUMMARY
68+
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:dev-${{ steps.meta.outputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY
69+
echo "- \`${{ env.REGISTRY_GHCR }}:dev\`" >> $GITHUB_STEP_SUMMARY
70+
echo "- \`${{ env.REGISTRY_GHCR }}:dev-${{ steps.meta.outputs.short_sha }}\`" >> $GITHUB_STEP_SUMMARY
71+
echo "**Test the dev image:**" >> $GITHUB_STEP_SUMMARY
72+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
73+
echo "docker pull ${{ env.REGISTRY_DOCKERHUB }}:dev" >> $GITHUB_STEP_SUMMARY
74+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
REGISTRY_DOCKERHUB: wgtechlabs/unthread-webhook-server
9+
REGISTRY_GHCR: ghcr.io/wgtechlabs/unthread-webhook-server
10+
11+
jobs:
12+
build-production:
13+
name: Build Production Images
14+
runs-on: ubuntu-latest
15+
if: startsWith(github.ref, 'refs/tags/')
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
with:
24+
driver: cloud
25+
endpoint: "wgtechlabs/unthread-bot-builder"
26+
install: true
27+
28+
- name: Login to Docker Hub
29+
uses: docker/login-action@v3
30+
with:
31+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
32+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
33+
34+
- name: Login to GitHub Container Registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Extract version from package.json
42+
id: version
43+
run: |
44+
VERSION=$(node -p "require('./package.json').version")
45+
echo "version=$VERSION" >> $GITHUB_OUTPUT
46+
echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
47+
echo "minor=$(echo $VERSION | cut -d. -f1-2)" >> $GITHUB_OUTPUT
48+
echo "patch=$(echo $VERSION | cut -d. -f1-3)" >> $GITHUB_OUTPUT
49+
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
50+
51+
- name: Generate Docker tags
52+
id: tags
53+
run: |
54+
VERSION="${{ steps.version.outputs.version }}"
55+
MAJOR="${{ steps.version.outputs.major }}"
56+
MINOR="${{ steps.version.outputs.minor }}"
57+
PATCH="${{ steps.version.outputs.patch }}"
58+
59+
# Docker Hub tags (no 'v' prefix)
60+
DOCKERHUB_TAGS="${{ env.REGISTRY_DOCKERHUB }}:latest"
61+
DOCKERHUB_TAGS="$DOCKERHUB_TAGS,${{ env.REGISTRY_DOCKERHUB }}:$VERSION"
62+
DOCKERHUB_TAGS="$DOCKERHUB_TAGS,${{ env.REGISTRY_DOCKERHUB }}:$PATCH"
63+
DOCKERHUB_TAGS="$DOCKERHUB_TAGS,${{ env.REGISTRY_DOCKERHUB }}:$MINOR"
64+
DOCKERHUB_TAGS="$DOCKERHUB_TAGS,${{ env.REGISTRY_DOCKERHUB }}:$MAJOR"
65+
66+
# GitHub Container Registry tags (with 'v' prefix)
67+
GHCR_TAGS="${{ env.REGISTRY_GHCR }}:latest"
68+
GHCR_TAGS="$GHCR_TAGS,${{ env.REGISTRY_GHCR }}:v$VERSION"
69+
GHCR_TAGS="$GHCR_TAGS,${{ env.REGISTRY_GHCR }}:v$PATCH"
70+
GHCR_TAGS="$GHCR_TAGS,${{ env.REGISTRY_GHCR }}:v$MINOR"
71+
GHCR_TAGS="$GHCR_TAGS,${{ env.REGISTRY_GHCR }}:v$MAJOR"
72+
73+
# Combine all tags
74+
ALL_TAGS="$DOCKERHUB_TAGS,$GHCR_TAGS"
75+
76+
echo "tags=$ALL_TAGS" >> $GITHUB_OUTPUT
77+
78+
- name: Build and push production images
79+
uses: docker/build-push-action@v5
80+
with:
81+
context: .
82+
push: true
83+
platforms: linux/amd64,linux/arm64
84+
tags: ${{ steps.tags.outputs.tags }}
85+
labels: |
86+
org.opencontainers.image.title=Unthread Webhook Server
87+
org.opencontainers.image.description=A Node.js server application that receives webhook events from Unthread.io
88+
org.opencontainers.image.version=${{ steps.version.outputs.version }}
89+
org.opencontainers.image.created=${{ steps.version.outputs.build_date }}
90+
org.opencontainers.image.revision=${{ github.sha }}
91+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
92+
org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}
93+
org.opencontainers.image.licenses=GPL-3.0
94+
cache-from: type=gha
95+
cache-to: type=gha,mode=max
96+
97+
- name: Run Trivy vulnerability scanner
98+
uses: aquasecurity/[email protected]
99+
with:
100+
image-ref: ${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.version }}
101+
format: 'sarif'
102+
output: 'trivy-results.sarif'
103+
104+
- name: Upload Trivy scan results to GitHub Security tab
105+
uses: github/codeql-action/upload-sarif@v3
106+
if: always()
107+
with:
108+
sarif_file: 'trivy-results.sarif'
109+
110+
- name: Production release summary
111+
run: |
112+
echo "## πŸš€ Production Release Complete" >> $GITHUB_STEP_SUMMARY
113+
echo "**Version:** \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
114+
echo "**Release:** \`${{ github.event.release.tag_name }}\`" >> $GITHUB_STEP_SUMMARY
115+
echo "" >> $GITHUB_STEP_SUMMARY
116+
echo "**Docker Hub Images:**" >> $GITHUB_STEP_SUMMARY
117+
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:latest\`" >> $GITHUB_STEP_SUMMARY
118+
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
119+
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.patch }}\`" >> $GITHUB_STEP_SUMMARY
120+
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.minor }}\`" >> $GITHUB_STEP_SUMMARY
121+
echo "- \`${{ env.REGISTRY_DOCKERHUB }}:${{ steps.version.outputs.major }}\`" >> $GITHUB_STEP_SUMMARY
122+
echo "" >> $GITHUB_STEP_SUMMARY
123+
echo "**GitHub Container Registry Images:**" >> $GITHUB_STEP_SUMMARY
124+
echo "- \`${{ env.REGISTRY_GHCR }}:latest\`" >> $GITHUB_STEP_SUMMARY
125+
echo "- \`${{ env.REGISTRY_GHCR }}:v${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
126+
echo "- \`${{ env.REGISTRY_GHCR }}:v${{ steps.version.outputs.patch }}\`" >> $GITHUB_STEP_SUMMARY
127+
echo "- \`${{ env.REGISTRY_GHCR }}:v${{ steps.version.outputs.minor }}\`" >> $GITHUB_STEP_SUMMARY
128+
echo "- \`${{ env.REGISTRY_GHCR }}:v${{ steps.version.outputs.major }}\`" >> $GITHUB_STEP_SUMMARY
129+
echo "" >> $GITHUB_STEP_SUMMARY
130+
echo "**Deploy with:**" >> $GITHUB_STEP_SUMMARY
131+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
132+
echo "docker pull ${{ env.REGISTRY_DOCKERHUB }}:latest" >> $GITHUB_STEP_SUMMARY
133+
echo "# OR" >> $GITHUB_STEP_SUMMARY
134+
echo "docker pull ${{ env.REGISTRY_GHCR }}:latest" >> $GITHUB_STEP_SUMMARY
135+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Validate
2+
3+
on:
4+
pull_request:
5+
branches: [dev, main]
6+
7+
jobs:
8+
validate:
9+
name: Validate Changes
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'yarn'
21+
22+
- name: Install dependencies
23+
run: yarn install --frozen-lockfile
24+
25+
- name: Type checking
26+
run: yarn type-check
27+
28+
- name: Build TypeScript
29+
run: yarn build
30+
31+
- name: Test Docker build (no push)
32+
run: |
33+
echo "Testing Docker build..."
34+
docker build -t test-build .
35+
echo "Build successful, cleaning up..."
36+
docker image rm test-build
37+
echo "βœ… Docker build test completed"

β€Ž.gitignoreβ€Ž

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,9 @@ ai_context/
134134

135135
# Enforce Yarn usage - ignore npm lockfile
136136
package-lock.json
137+
138+
# Environment files with sensitive data
139+
.env
140+
.env.local
141+
.env.*.local
142+
.env.production

0 commit comments

Comments
Β (0)