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 < ${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."