-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2721fc0
commit f5e4032
Showing
4 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build, Version Bump and Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
if: github.event.pull_request.merged == true || github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "GitHub Actions Bot" | ||
git config user.email "[email protected]" | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Get current version | ||
id: version | ||
run: | | ||
CURRENT_VERSION=$(node -p "require('./package.json').version") | ||
IFS='.' read -ra VERSION_PARTS <<< "$CURRENT_VERSION" | ||
BUILD_NUM=$((${VERSION_PARTS[2]} + 1)) | ||
NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$BUILD_NUM" | ||
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
- name: Update version in package.json | ||
run: | | ||
NEW_VERSION=${{ steps.version.outputs.new_version }} | ||
npm version $NEW_VERSION --no-git-tag-version | ||
- name: Build project | ||
run: npm run build | ||
|
||
- name: Commit changes | ||
run: | | ||
NEW_VERSION=${{ steps.version.outputs.new_version }} | ||
git add package.json package-lock.json dist/ | ||
git commit -m "build: $NEW_VERSION" | ||
git push | ||
- name: Create and push tag | ||
run: | | ||
NEW_VERSION=${{ steps.version.outputs.new_version }} | ||
git tag $NEW_VERSION | ||
git push origin $NEW_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Build Verification | ||
|
||
on: | ||
# Run on all PRs | ||
pull_request: | ||
branches: | ||
- '*' | ||
# Run on all pushes except master (since master has its own build workflow) | ||
push: | ||
branches: | ||
- '*' | ||
- '!master' | ||
|
||
jobs: | ||
verify-build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Lint | ||
run: npm run lint | ||
continue-on-error: true # Don't fail the build for lint errors | ||
|
||
- name: Type check | ||
if: ${{ hashFiles('tsconfig.json') }} # Only run if TypeScript is used | ||
run: npm run typecheck || npm run check:types || echo "No type checking script found" | ||
continue-on-error: true | ||
|
||
- name: Run tests | ||
run: npm test | ||
continue-on-error: true # Don't fail if tests aren't set up | ||
|
||
- name: Verify build | ||
run: | | ||
npm run build | ||
if [ $? -eq 0 ]; then | ||
echo "✅ Build successful" | ||
else | ||
echo "❌ Build failed" | ||
exit 1 | ||
fi | ||
- name: Check bundle size | ||
run: | | ||
BUILD_DIR="dist" | ||
if [ -d "$BUILD_DIR" ]; then | ||
echo "Bundle sizes:" | ||
du -h "$BUILD_DIR"/* | ||
else | ||
echo "Build directory not found" | ||
exit 1 | ||
fi | ||
- name: Check for common build issues | ||
run: | | ||
# Check if dist directory exists | ||
if [ ! -d "dist" ]; then | ||
echo "❌ dist directory is missing" | ||
exit 1 | ||
fi | ||
# Check if main bundle exists (adjust the pattern based on your build output) | ||
if ! ls dist/*.js >/dev/null 2>&1; then | ||
echo "❌ No JavaScript bundles found in dist/" | ||
exit 1 | ||
fi | ||
# Check if any source maps are generated (if expected) | ||
if ! ls dist/*.map >/dev/null 2>&1; then | ||
echo "⚠️ Warning: No source maps found" | ||
fi | ||
echo "✅ All build artifacts verified" | ||
- name: Status Report | ||
if: always() | ||
run: | | ||
echo "Build Verification Summary:" | ||
echo "==========================" | ||
echo "✓ Dependencies installed" | ||
echo "✓ Build completed" | ||
echo "✓ Bundle size checked" | ||
echo "✓ Build artifacts verified" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,7 @@ yarn-error.log* | |
# Local Netlify folder | ||
.netlify | ||
|
||
|
||
# Gitleaks | ||
gitleaks-baseline.json | ||
.secrets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters