From b49a2e2717d9cb5dc059792db88ad682d770dca4 Mon Sep 17 00:00:00 2001 From: katamaz Date: Thu, 28 May 2026 15:15:35 +0300 Subject: [PATCH] fix build --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9adf754..c56c49b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,14 +24,34 @@ jobs: - name: Rename output run: mv output.php totallynottokenstealer.php - - name: Generate release tag - id: tag - run: echo "tag=release-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT + - name: Create release and upload artifact + env: + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Ensure jq is available + if ! command -v jq &> /dev/null; then + apt-get install -y jq + fi - - name: Create release with artifact - uses: actions/gitea-release-action@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - tag_name: ${{ steps.tag.outputs.tag }} - release_name: "Release ${{ steps.tag.outputs.tag }}" - files: totallynottokenstealer.php \ No newline at end of file + # Strip any trailing slash from server URL + BASE_URL="${GITHUB_SERVER_URL%/}" + TAG="release-$(date +'%Y%m%d%H%M%S')" + + # Create the release + RELEASE_ID=$(curl -s -X POST "$BASE_URL/api/v1/repos/$GITHUB_REPOSITORY/releases" \ + -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"$TAG\",\"name\":\"Release $TAG\",\"target_commitish\":\"$GITHUB_SHA\"}" \ + | jq -r '.id') + + if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then + echo "Failed to create release" + exit 1 + fi + + echo "Created release ID: $RELEASE_ID" + + # Upload + curl -s -X POST "$BASE_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets" \ + -H "Authorization: token $GITEA_TOKEN" \ + -F "attachment=@totallynottokenstealer.php"