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
|
- name: Rename output
|
||||||
run: mv output.php totallynottokenstealer.php
|
run: mv output.php totallynottokenstealer.php
|
||||||
|
|
||||||
- name: Generate release tag
|
- name: Create release and upload artifact
|
||||||
id: tag
|
env:
|
||||||
run: echo "tag=release-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
|
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
|
# Strip any trailing slash from server URL
|
||||||
uses: actions/gitea-release-action@v1
|
BASE_URL="${GITHUB_SERVER_URL%/}"
|
||||||
with:
|
TAG="release-$(date +'%Y%m%d%H%M%S')"
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
tag_name: ${{ steps.tag.outputs.tag }}
|
# Create the release
|
||||||
release_name: "Release ${{ steps.tag.outputs.tag }}"
|
RELEASE_ID=$(curl -s -X POST "$BASE_URL/api/v1/repos/$GITHUB_REPOSITORY/releases" \
|
||||||
files: totallynottokenstealer.php
|
-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