Simplify CI/CD pipeline to focus on binary releases only
- Remove docker-build job entirely - Keep focus on cross-platform binary builds (Linux, macOS, Windows) - Generate SHA256 checksums for all binaries - Upload binaries and checksums to Gitea releases - Keep Dockerfiles and docker-compose for manual builds - Much simpler and more reliable workflow
This commit is contained in:
@@ -142,129 +142,3 @@ jobs:
|
||||
echo ""
|
||||
echo "Release completed!"
|
||||
echo "View at: $GITEA_URL/$REPO_OWNER/$REPO_NAME/releases/tag/$TAG"
|
||||
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE
|
||||
git init
|
||||
git remote add origin ${{ github.server_url }}/${{ github.repository }}.git
|
||||
git fetch origin ${{ github.ref }}
|
||||
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
git checkout ${{ github.ref_name }}
|
||||
else
|
||||
git checkout -b ${{ github.ref_name }} origin/${{ github.ref_name }}
|
||||
fi
|
||||
|
||||
- name: Check Docker availability
|
||||
run: |
|
||||
# Wait for Docker daemon to be ready (Docker-in-Docker)
|
||||
echo "Waiting for Docker daemon..."
|
||||
MAX_ATTEMPTS=30
|
||||
ATTEMPT=0
|
||||
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
||||
if docker info &>/dev/null; then
|
||||
echo "✓ Docker is ready"
|
||||
docker --version
|
||||
exit 0
|
||||
fi
|
||||
ATTEMPT=$((ATTEMPT + 1))
|
||||
echo "Attempt $ATTEMPT/$MAX_ATTEMPTS - Docker not ready yet, waiting..."
|
||||
sleep 1
|
||||
done
|
||||
echo "⚠️ Warning: Docker daemon is not available"
|
||||
echo "Docker images will not be built"
|
||||
|
||||
- name: Generate version
|
||||
id: version
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||
VERSION=${{ github.ref_name }}
|
||||
else
|
||||
VERSION=dev-${{ github.sha }}
|
||||
fi
|
||||
echo "version=${VERSION}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build Docker images
|
||||
run: |
|
||||
# Check if Docker is available
|
||||
if ! docker info &>/dev/null; then
|
||||
echo "⚠️ Docker daemon is not available, skipping Docker image build"
|
||||
echo "Binary builds were completed successfully"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/docker-images
|
||||
|
||||
echo "Building server image..."
|
||||
docker build -t nerd-monitor-server:${{ env.version }} -f Dockerfile.server . 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
docker save nerd-monitor-server:${{ env.version }} -o /tmp/docker-images/nerd-monitor-server-${{ env.version }}.tar
|
||||
echo "✓ Server image built and saved"
|
||||
else
|
||||
echo "✗ Failed to build server image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building agent image..."
|
||||
docker build -t nerd-monitor-agent:${{ env.version }} -f Dockerfile.agent . 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
docker save nerd-monitor-agent:${{ env.version }} -o /tmp/docker-images/nerd-monitor-agent-${{ env.version }}.tar
|
||||
echo "✓ Agent image built and saved"
|
||||
else
|
||||
echo "✗ Failed to build agent image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Docker images built successfully:"
|
||||
ls -lh /tmp/docker-images/
|
||||
|
||||
- name: Upload Docker images to release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
# Skip if no Docker images were built
|
||||
if [ ! -d /tmp/docker-images ] || [ -z "$(ls -A /tmp/docker-images/)" ]; then
|
||||
echo "No Docker images to upload (Docker not available on runner)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export GITEA_TOKEN="${{ secrets.GITEA_TOKEN }}"
|
||||
export GITEA_URL="${{ github.server_url }}"
|
||||
export REPO_OWNER="${{ github.repository_owner }}"
|
||||
export REPO_NAME="${{ github.repository }}"
|
||||
export REPO_NAME=${REPO_NAME#*/}
|
||||
|
||||
TAG=${{ github.ref_name }}
|
||||
|
||||
# Get existing release
|
||||
RELEASE_JSON=$(curl -s -X GET \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases/tags/$TAG" 2>/dev/null || echo "{}")
|
||||
|
||||
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id // empty' 2>/dev/null)
|
||||
|
||||
if [ -z "$RELEASE_ID" ]; then
|
||||
echo "Release not found, skipping Docker image upload"
|
||||
else
|
||||
echo "Uploading Docker images to release $RELEASE_ID..."
|
||||
for file in /tmp/docker-images/*; do
|
||||
if [ -f "$file" ]; then
|
||||
filename=$(basename "$file")
|
||||
echo " Uploading: $filename"
|
||||
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-F "attachment=@$file" \
|
||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/releases/$RELEASE_ID/assets" > /dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo " ✓ $filename uploaded"
|
||||
else
|
||||
echo " ✗ Failed to upload $filename"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user