All checks were successful
Build MapleDeploy Coolify Image / build (push) Successful in 22s
Storage zone was accidentally created in NY. Recreated as 'coolify-update' in DE (Falkenstein) to keep update artifacts in EU jurisdiction, consistent with Bunny.net data sovereignty justification. Updated storage zone name, pull zone ID, and reverted storage endpoint to default (storage.bunnycdn.com).
100 lines
3.4 KiB
YAML
100 lines
3.4 KiB
YAML
name: Build MapleDeploy Coolify Image
|
|
|
|
on:
|
|
push:
|
|
branches: [mapledeploy]
|
|
paths-ignore:
|
|
- "*.md"
|
|
- ".github/**"
|
|
- "templates/**"
|
|
|
|
env:
|
|
REGISTRY: forgejo.mapledeploy.ca
|
|
CDN_STORAGE_ZONE: coolify-update
|
|
CDN_PULL_ZONE_ID: "5338895"
|
|
CDN_BASE_URL: https://updates.mapledeploy.ca
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get version
|
|
id: version
|
|
run: |
|
|
VERSION=$(sed -n "s/.*'version' => '\([^']*\)'.*/\1/p" config/constants.php)
|
|
HELPER_VERSION=$(sed -n "s/.*'helper_version' => '\([^']*\)'.*/\1/p" config/constants.php)
|
|
REALTIME_VERSION=$(sed -n "s/.*'realtime_version' => '\([^']*\)'.*/\1/p" config/constants.php)
|
|
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
|
|
echo "HELPER_VERSION=${HELPER_VERSION}" >> "$GITHUB_OUTPUT"
|
|
echo "REALTIME_VERSION=${REALTIME_VERSION}" >> "$GITHUB_OUTPUT"
|
|
echo "Building version: ${VERSION} (helper: ${HELPER_VERSION}, realtime: ${REALTIME_VERSION})"
|
|
|
|
- name: Login to Forgejo registry
|
|
run: |
|
|
echo "${{ secrets.FORGEJO_TOKEN }}" | docker login ${{ env.REGISTRY }} -u ${{ github.repository_owner }} --password-stdin
|
|
|
|
- name: Build image
|
|
run: |
|
|
DOCKER_BUILDKIT=1 docker build -f docker/production/Dockerfile \
|
|
-t ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.version.outputs.VERSION }} \
|
|
-t ${{ env.REGISTRY }}/${{ github.repository }}:latest \
|
|
.
|
|
|
|
- name: Push image
|
|
run: |
|
|
docker push ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.version.outputs.VERSION }}
|
|
docker push ${{ env.REGISTRY }}/${{ github.repository }}:latest
|
|
|
|
- name: Generate versions.json
|
|
run: |
|
|
cat > versions.json <<EOF
|
|
{
|
|
"coolify": {
|
|
"v4": {
|
|
"version": "${{ steps.version.outputs.VERSION }}"
|
|
},
|
|
"helper": {
|
|
"version": "${{ steps.version.outputs.HELPER_VERSION }}"
|
|
},
|
|
"realtime": {
|
|
"version": "${{ steps.version.outputs.REALTIME_VERSION }}"
|
|
}
|
|
}
|
|
}
|
|
EOF
|
|
echo "Generated versions.json:"
|
|
cat versions.json
|
|
|
|
- name: Install curl
|
|
run: apk add --no-cache curl
|
|
|
|
- name: Upload artifacts to Bunny CDN
|
|
run: |
|
|
STORAGE_URL="https://storage.bunnycdn.com/${{ env.CDN_STORAGE_ZONE }}/coolify"
|
|
|
|
upload() {
|
|
local file="$1"
|
|
local dest="$2"
|
|
echo "Uploading ${file} -> ${dest}"
|
|
curl -fsSL -X PUT "${STORAGE_URL}/${dest}" \
|
|
-H "AccessKey: ${{ secrets.BUNNY_CDN_STORAGE_KEY }}" \
|
|
-H "Content-Type: application/octet-stream" \
|
|
--data-binary @"${file}"
|
|
}
|
|
|
|
upload versions.json versions.json
|
|
upload scripts/upgrade.sh upgrade.sh
|
|
upload docker-compose.yml docker-compose.yml
|
|
upload docker-compose.prod.yml docker-compose.prod.yml
|
|
upload .env.production .env.production
|
|
|
|
echo "All artifacts uploaded."
|
|
|
|
- name: Purge CDN cache
|
|
run: |
|
|
curl -fsSL -X POST "https://api.bunny.net/pullzone/${{ env.CDN_PULL_ZONE_ID }}/purgeCache" \
|
|
-H "AccessKey: ${{ secrets.BUNNY_API_KEY }}" \
|
|
-H "Content-Type: application/json"
|
|
echo "CDN cache purged."
|