fix: add CORS headers, make ci builds as preleases

This commit is contained in:
Nikita Kiselev
2025-07-10 19:13:39 +03:00
parent 9735d48957
commit 55153531fb
3 changed files with 11 additions and 8 deletions

View File

@@ -2,7 +2,8 @@ name: Telegram Mini App Shop Builder
on: on:
push: push:
tags: ['v*'] branches:
- master
permissions: permissions:
contents: write contents: write
@@ -39,10 +40,12 @@ jobs:
with: with:
fetch-depth: 0 # to fetch tags fetch-depth: 0 # to fetch tags
- name: Extract tag and set filename - name: Extract latest tag and set filename
id: meta id: meta
run: | run: |
TAG=${GITHUB_REF#refs/tags/} LAST_TAG=$(git describe --tags --abbrev=0)
SHORT_SHA=$(git rev-parse --short=7 HEAD)
TAG="${LAST_TAG}+${SHORT_SHA}"
echo "tag=$TAG" >> $GITHUB_OUTPUT echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "filename=oc_telegram_shop_${TAG}.ocmod.zip" >> $GITHUB_OUTPUT echo "filename=oc_telegram_shop_${TAG}.ocmod.zip" >> $GITHUB_OUTPUT
@@ -58,6 +61,7 @@ jobs:
- name: Create GitHub Release - name: Create GitHub Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
prerelease: true
tag_name: ${{ steps.meta.outputs.tag }} tag_name: ${{ steps.meta.outputs.tag }}
files: ./build/${{ steps.meta.outputs.filename }} files: ./build/${{ steps.meta.outputs.filename }}
generate_release_notes: true generate_release_notes: true

View File

@@ -64,9 +64,4 @@ class Controllertgshophandle extends Controller
$app->bootAndHandleRequest(); $app->bootAndHandleRequest();
} }
public function spa()
{
}
} }

View File

@@ -43,5 +43,9 @@ class JsonResponse extends Response
{ {
http_response_code($this->getCode()); http_response_code($this->getCode());
header('Content-Type: application/json'); header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header('Access-Control-Allow-Headers: Content-Type, Authorization');
header('Access-Control-Allow-Credentials: true');
} }
} }