Compare commits
No commits in common. "f3b11c7d63eb87ef6b66f5d38b3304aa867812b6" and "c933f5f8cc12533d5a92d3a08d822d87a5a38a00" have entirely different histories.
f3b11c7d63
...
c933f5f8cc
6 changed files with 9 additions and 117 deletions
|
|
@ -18,7 +18,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build --build-arg VERSION=test --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") -t threejs-test:test .
|
docker build -t threejs-test:test .
|
||||||
|
|
||||||
- name: Validate Image
|
- name: Validate Image
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -82,14 +82,11 @@ jobs:
|
||||||
echo "tag=v$NEW_VERSION" >> $GITHUB_OUTPUT
|
echo "tag=v$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "Latest tag: $LATEST_TAG"
|
echo "Latest tag: $LATEST_TAG"
|
||||||
echo "New version: $NEW_VERSION"
|
echo "New version: $NEW_VERSION"
|
||||||
echo "Current VERSION file: $(cat VERSION 2>/dev/null || echo 'not found')"
|
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
IMAGE_NAME="git.jusemon.com/jusemon/threejs-test:${{ steps.version.outputs.version }}"
|
||||||
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
docker build -t "$IMAGE_NAME" .
|
||||||
IMAGE_NAME="git.jusemon.com/jusemon/threejs-test:$VERSION"
|
|
||||||
docker build --build-arg VERSION="$VERSION" --build-arg BUILD_DATE="$BUILD_DATE" -t "$IMAGE_NAME" .
|
|
||||||
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
|
echo "IMAGE_NAME=$IMAGE_NAME" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Push Docker Image
|
- name: Push Docker Image
|
||||||
|
|
@ -157,56 +154,6 @@ jobs:
|
||||||
echo "TAG_CREATED=true" >> $GITHUB_ENV
|
echo "TAG_CREATED=true" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Update Version Files
|
|
||||||
run: |
|
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
|
||||||
TAG="${{ steps.version.outputs.tag }}"
|
|
||||||
|
|
||||||
echo "📝 Updating version files to: $VERSION"
|
|
||||||
|
|
||||||
# Configure git
|
|
||||||
git config user.name "forgejo-actions"
|
|
||||||
git config user.email "forgejo-actions@forgejo.io"
|
|
||||||
|
|
||||||
# Fetch latest changes to avoid conflicts
|
|
||||||
git fetch origin main || echo "Fetch completed or already up to date"
|
|
||||||
git checkout main || echo "Already on main"
|
|
||||||
|
|
||||||
# Update VERSION file
|
|
||||||
echo "$VERSION" > VERSION
|
|
||||||
|
|
||||||
# Update portainer.yml with new version
|
|
||||||
sed -i "s|\(image: git.jusemon.com/jusemon/threejs-test:\)[0-9.]*|\1$VERSION|" portainer.yml
|
|
||||||
|
|
||||||
# Verify the updates
|
|
||||||
if grep -q "^$VERSION$" VERSION && grep -q "image: git.jusemon.com/jusemon/threejs-test:$VERSION" portainer.yml; then
|
|
||||||
echo "✅ Successfully updated VERSION and portainer.yml to $VERSION"
|
|
||||||
else
|
|
||||||
echo "❌ Failed to update version files"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if there are changes to commit
|
|
||||||
if git diff --quiet VERSION portainer.yml; then
|
|
||||||
echo "ℹ️ No changes to commit (files already up to date)"
|
|
||||||
else
|
|
||||||
# Stage and commit with [skip ci] to prevent infinite loop
|
|
||||||
# Note: Forgejo Actions should respect [skip ci] in commit messages
|
|
||||||
git add VERSION portainer.yml
|
|
||||||
git commit -m "chore: update version to $VERSION [skip ci]" || {
|
|
||||||
echo "⚠️ Commit failed (may already be committed)"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# Push to main branch
|
|
||||||
git push origin main || {
|
|
||||||
echo "⚠️ Push failed (may need manual intervention or branch protection)"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "✅ Successfully committed and pushed version update to $VERSION"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Job Summary
|
- name: Job Summary
|
||||||
if: success()
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -236,15 +183,11 @@ jobs:
|
||||||
echo "- ⚠️ Tag \`$TAG\` already exists, skipped creation" >> "$SUMMARY_FILE"
|
echo "- ⚠️ Tag \`$TAG\` already exists, skipped creation" >> "$SUMMARY_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat >> "$SUMMARY_FILE" << EOF
|
cat >> "$SUMMARY_FILE" << 'EOF'
|
||||||
|
|
||||||
### Version Files
|
|
||||||
- ✅ VERSION file updated to \`$VERSION\`
|
|
||||||
- ✅ portainer.yml updated to \`$VERSION\`
|
|
||||||
|
|
||||||
### Pull Command
|
### Pull Command
|
||||||
\`\`\`bash
|
```bash
|
||||||
docker pull git.jusemon.com/jusemon/threejs-test:latest
|
docker pull git.jusemon.com/jusemon/threejs-test:latest
|
||||||
\`\`\`
|
```
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,5 @@
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
# Accept build argument for version
|
|
||||||
ARG VERSION=dev
|
|
||||||
ARG BUILD_DATE=unknown
|
|
||||||
|
|
||||||
# Create version.json file with build information
|
|
||||||
RUN printf '{"version":"%s","buildDate":"%s"}\n' "${VERSION}" "${BUILD_DATE}" > /usr/share/nginx/html/version.json
|
|
||||||
|
|
||||||
# Copy the HTML file
|
# Copy the HTML file
|
||||||
COPY index.html /usr/share/nginx/html/index.html
|
COPY index.html /usr/share/nginx/html/index.html
|
||||||
|
|
||||||
|
|
|
||||||
2
VERSION
2
VERSION
|
|
@ -1,2 +0,0 @@
|
||||||
0.1.5
|
|
||||||
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
name: threejs-test
|
name: threejs-test
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
ui:
|
||||||
build:
|
build: .
|
||||||
context: .
|
|
||||||
args:
|
|
||||||
VERSION: ${VERSION:-dev}
|
|
||||||
BUILD_DATE: ${BUILD_DATE:-unknown}
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|
|
||||||
38
index.html
38
index.html
|
|
@ -72,25 +72,10 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
|
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
|
||||||
}
|
}
|
||||||
#version {
|
|
||||||
position: absolute;
|
|
||||||
top: 20px;
|
|
||||||
right: 20px;
|
|
||||||
color: rgba(255, 255, 255, 0.7);
|
|
||||||
font-size: 14px;
|
|
||||||
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
|
|
||||||
z-index: 100;
|
|
||||||
font-family: 'Courier New', monospace;
|
|
||||||
}
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
#instructions {
|
#instructions {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
#version {
|
|
||||||
font-size: 12px;
|
|
||||||
top: 10px;
|
|
||||||
right: 10px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
@ -100,8 +85,6 @@
|
||||||
<div>Health: <span id="health">100</span></div>
|
<div>Health: <span id="health">100</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="version">v<span id="versionNumber">-</span></div>
|
|
||||||
|
|
||||||
<div id="gameOver">
|
<div id="gameOver">
|
||||||
<h1>Game Over!</h1>
|
<h1>Game Over!</h1>
|
||||||
<p>Final Score: <span id="finalScore">0</span></p>
|
<p>Final Score: <span id="finalScore">0</span></p>
|
||||||
|
|
@ -114,27 +97,6 @@
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
// Load and display version information
|
|
||||||
(function() {
|
|
||||||
fetch('/version.json')
|
|
||||||
.then(response => {
|
|
||||||
if (response.ok) {
|
|
||||||
return response.json();
|
|
||||||
}
|
|
||||||
throw new Error('Version file not found');
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
const versionElement = document.getElementById('versionNumber');
|
|
||||||
if (versionElement && data.version) {
|
|
||||||
versionElement.textContent = data.version;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
// Silently fail if version.json doesn't exist (e.g., in development)
|
|
||||||
console.debug('Version information not available:', error.message);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
|
|
||||||
// Base GameObject class
|
// Base GameObject class
|
||||||
class GameObject {
|
class GameObject {
|
||||||
constructor(scene, groundSize) {
|
constructor(scene, groundSize) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ name: threejs-test
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: git.jusemon.com/jusemon/threejs-test:0.1.5
|
image: git.jusemon.com/jusemon/threejs-test:latest
|
||||||
pull_policy: build
|
pull_policy: build
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue