Merge branch 'main' into master
All checks were successful
/ build (pull_request) Successful in 1m1s
All checks were successful
/ build (pull_request) Successful in 1m1s
This commit is contained in:
commit
8ff9cc02e7
157
.gitea/workflows/docker-build.yml
Normal file
157
.gitea/workflows/docker-build.yml
Normal file
@ -0,0 +1,157 @@
|
||||
ame: Build Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
run: |
|
||||
VERSION=$(cat VERSION 2>/dev/null || echo "0.0.0")
|
||||
SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7)
|
||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||
echo "sha_short=${SHA_SHORT}" >> $GITHUB_OUTPUT
|
||||
echo "version_sha=v${VERSION}-${SHA_SHORT}" >> $GITHUB_OUTPUT
|
||||
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
||||
echo "timestamp=$(date -u +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
tags: |
|
||||
paper-dynasty:latest
|
||||
paper-dynasty:v${{ steps.meta.outputs.version }}
|
||||
paper-dynasty:${{ steps.meta.outputs.version_sha }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
outputs: type=docker,dest=/tmp/paper-dynasty-image.tar
|
||||
|
||||
- name: Build Summary
|
||||
run: |
|
||||
echo "## 🐳 Docker Build Successful! ✅" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Image Tags:**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- \`paper-dynasty:latest\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- \`paper-dynasty:v${{ steps.meta.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- \`paper-dynasty:${{ steps.meta.outputs.version_sha }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Build Details:**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Branch: \`${{ steps.meta.outputs.branch }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Commit: \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Timestamp: \`${{ steps.meta.outputs.timestamp }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "_Ready to deploy to production!_" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: Save build info
|
||||
run: |
|
||||
mkdir -p artifacts
|
||||
cat > artifacts/build-info.txt <<EOF
|
||||
Build Information
|
||||
==================
|
||||
Version: v${{ steps.meta.outputs.version }}
|
||||
Image: paper-dynasty:${{ steps.meta.outputs.version_sha }}
|
||||
Branch: ${{ steps.meta.outputs.branch }}
|
||||
Commit: ${{ github.sha }}
|
||||
Author: ${{ github.actor }}
|
||||
Timestamp: ${{ steps.meta.outputs.timestamp }}
|
||||
EOF
|
||||
|
||||
- name: Discord Notification - Success
|
||||
if: success() && github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "✅ Paper Dynasty Build Successful",
|
||||
"description": "Docker image built and ready to deploy!",
|
||||
"color": 3066993,
|
||||
"fields": [
|
||||
{
|
||||
"name": "Version",
|
||||
"value": "`v${{ steps.meta.outputs.version }}`",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Image Tag",
|
||||
"value": "`${{ steps.meta.outputs.version_sha }}`",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Branch",
|
||||
"value": "`${{ steps.meta.outputs.branch }}`",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Commit",
|
||||
"value": "`${{ steps.meta.outputs.sha_short }}`",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Author",
|
||||
"value": "${{ github.actor }}",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "View Run",
|
||||
"value": "[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})",
|
||||
"inline": false
|
||||
}
|
||||
],
|
||||
"timestamp": "${{ steps.meta.outputs.timestamp }}"
|
||||
}]
|
||||
}' \
|
||||
https://discord.com/api/webhooks/1468485116631453840/JALtLV8dO2IWso3tNcntHW8wDgQeMZuLgFKVUeoEY9ig_OPjjm4PmjvzwYebH5l7_Nxv
|
||||
|
||||
- name: Discord Notification - Failure
|
||||
if: failure() && github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
curl -H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"embeds": [{
|
||||
"title": "❌ Paper Dynasty Build Failed",
|
||||
"description": "Docker build encountered an error.",
|
||||
"color": 15158332,
|
||||
"fields": [
|
||||
{
|
||||
"name": "Branch",
|
||||
"value": "`${{ github.ref_name }}`",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Commit",
|
||||
"value": "`${{ github.sha }}`",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Author",
|
||||
"value": "${{ github.actor }}",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "View Logs",
|
||||
"value": "[Click here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})",
|
||||
"inline": false
|
||||
}
|
||||
],
|
||||
"timestamp": "'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'"
|
||||
}]
|
||||
}' \
|
||||
https://discord.com/api/webhooks/1468485116631453840/JALtLV8dO2IWso3tNcntHW8wDgQeMZuLgFKVUeoEY9ig_OPjjm4PmjvzwYebH5l7_Nxv
|
||||
|
||||
Loading…
Reference in New Issue
Block a user