Skip to content

Update HttpFileExecutorAsync.cs #628

Update HttpFileExecutorAsync.cs

Update HttpFileExecutorAsync.cs #628

Workflow file for this run

name: Build and publish Docker images
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
steps:
# ==========================
# Checkout repo
# ==========================
- uses: actions/checkout@v4
# ==========================
# Extract version from tag
# ==========================
- name: Get tag version number
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
# ==========================
# Build Angular ONCE (native runner)
# ==========================
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Build Angular frontend
run: |
cd frontend
npm ci
npm run build-prod
cd ..
# ==========================
# Setup Docker multi-arch
# ==========================
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# ==========================
# Login to DockerHub
# ==========================
- name: Login to DockerHub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
# ==========================
# Build & Push Backend (multi-arch)
# ==========================
- name: Build and push backend (multi-arch)
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
-f ./docker.backend \
-t servergardens/magic-backend:latest \
-t servergardens/magic-backend:${{ steps.get_version.outputs.VERSION }} \
--push .
# ==========================
# Build & Push Frontend (multi-arch, FAST)
# Uses single docker.frontend file (nginx only)
# ==========================
- name: Build and push frontend (multi-arch)
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
-f ./docker.frontend \
-t servergardens/magic-frontend:latest \
-t servergardens/magic-frontend:${{ steps.get_version.outputs.VERSION }} \
--push .
# ==========================
# Create SMALL magic.zip (deployment compatible)
# Keeps backend/ structure unchanged
# ==========================
- name: Package deployment zip (small)
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
echo "Creating deployment zip..."
mkdir release
cp -r backend release/
# Remove build junk + source code (optional but huge savings)
rm -rf release/backend/bin
rm -rf release/backend/obj
# Zip ONLY backend folder (deployment expects /backend/)
cd release
zip -r ../magic-$VERSION.zip backend
cd ..
# Also create magic.zip for "latest"
cp magic-$VERSION.zip magic.zip
# ==========================
# Upload release zips (Cloudflare-safe)
# ==========================
- name: Upload release zip files
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
curl -X PUT \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer ${{ secrets.API_TOKEN }}" \
-F "folder=/etc/releases/" \
-F "file=@magic-$VERSION.zip" \
"https://ainiro.io/magic/system/file-system/file"
curl -X PUT \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer ${{ secrets.API_TOKEN }}" \
-F "folder=/etc/releases/" \
-F "file=@magic.zip" \
"https://ainiro.io/magic/system/file-system/file"