Files
totallynottokenstealer/.github/workflows/build.yml
katamaz b49a2e2717
Some checks failed
Build and Release / build-and-release (push) Failing after 35s
fix build
2026-05-28 15:15:35 +03:00

58 lines
1.6 KiB
YAML

name: Build and Release
on:
push:
branches:
- main
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Run builder
run: bun run builder.js
- name: Rename output
run: mv output.php totallynottokenstealer.php
- 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
# 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"