Include version info in game
This commit is contained in:
parent
aeb14921bc
commit
f3b11c7d63
4 changed files with 114 additions and 8 deletions
|
|
@ -18,7 +18,7 @@ jobs:
|
|||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build -t threejs-test:test .
|
||||
docker build --build-arg VERSION=test --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") -t threejs-test:test .
|
||||
|
||||
- name: Validate Image
|
||||
run: |
|
||||
|
|
@ -82,11 +82,14 @@ jobs:
|
|||
echo "tag=v$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Latest tag: $LATEST_TAG"
|
||||
echo "New version: $NEW_VERSION"
|
||||
echo "Current VERSION file: $(cat VERSION 2>/dev/null || echo 'not found')"
|
||||
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
IMAGE_NAME="git.jusemon.com/jusemon/threejs-test:${{ steps.version.outputs.version }}"
|
||||
docker build -t "$IMAGE_NAME" .
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
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
|
||||
|
||||
- name: Push Docker Image
|
||||
|
|
@ -154,6 +157,56 @@ jobs:
|
|||
echo "TAG_CREATED=true" >> $GITHUB_ENV
|
||||
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
|
||||
if: success()
|
||||
run: |
|
||||
|
|
@ -183,11 +236,15 @@ jobs:
|
|||
echo "- ⚠️ Tag \`$TAG\` already exists, skipped creation" >> "$SUMMARY_FILE"
|
||||
fi
|
||||
|
||||
cat >> "$SUMMARY_FILE" << 'EOF'
|
||||
cat >> "$SUMMARY_FILE" << EOF
|
||||
|
||||
### Version Files
|
||||
- ✅ VERSION file updated to \`$VERSION\`
|
||||
- ✅ portainer.yml updated to \`$VERSION\`
|
||||
|
||||
### Pull Command
|
||||
```bash
|
||||
\`\`\`bash
|
||||
docker pull git.jusemon.com/jusemon/threejs-test:latest
|
||||
```
|
||||
\`\`\`
|
||||
EOF
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue