This commit is contained in:
40
.github/workflows/build.yml
vendored
40
.github/workflows/build.yml
vendored
@@ -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
|
||||
# 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"
|
||||
|
||||
Reference in New Issue
Block a user