.
This commit is contained in:
@@ -25,9 +25,11 @@ jobs:
|
||||
|
||||
- name: Delete Previous Latest Release
|
||||
continue-on-error: true
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
run: |
|
||||
curl -X DELETE \
|
||||
-H "Authorization: token ${{ secrets.CI_TOKEN }}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.salastil.com/api/v1/repos/Salastil/Sneedchat-Discord-Bridge-Go/releases/tags/latest"
|
||||
|
||||
- name: Delete Latest Tag
|
||||
@@ -43,12 +45,20 @@ jobs:
|
||||
git push origin latest
|
||||
|
||||
- name: Create Latest Release and Upload Binary
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
run: |
|
||||
set -x
|
||||
|
||||
# Verify token exists
|
||||
if [ -z "$GITEA_TOKEN" ]; then
|
||||
echo "ERROR: CI_TOKEN secret is not set!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create release
|
||||
RESPONSE=$(curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.CI_TOKEN }}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"tag_name": "latest",
|
||||
@@ -61,7 +71,7 @@ jobs:
|
||||
|
||||
echo "Create release response: $RESPONSE"
|
||||
|
||||
# Extract release ID using grep and sed (no jq dependency)
|
||||
# Extract release ID
|
||||
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
|
||||
|
||||
echo "Release ID: $RELEASE_ID"
|
||||
@@ -72,13 +82,11 @@ jobs:
|
||||
fi
|
||||
|
||||
# Upload binary
|
||||
UPLOAD_RESPONSE=$(curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.CI_TOKEN }}" \
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @Sneedchat-Discord-Bridge \
|
||||
"https://git.salastil.com/api/v1/repos/Salastil/Sneedchat-Discord-Bridge-Go/releases/$RELEASE_ID/assets?name=Sneedchat-Discord-Bridge")
|
||||
|
||||
echo "Upload response: $UPLOAD_RESPONSE"
|
||||
"https://git.salastil.com/api/v1/repos/Salastil/Sneedchat-Discord-Bridge-Go/releases/$RELEASE_ID/assets?name=Sneedchat-Discord-Bridge"
|
||||
|
||||
version-release:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -103,12 +111,20 @@ jobs:
|
||||
GOOS=darwin GOARCH=arm64 go build -o dist/Sneedchat-Discord-Bridge-darwin-arm64 .
|
||||
|
||||
- name: Create Version Release and Upload Binaries
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
run: |
|
||||
set -x
|
||||
|
||||
# Verify token exists
|
||||
if [ -z "$GITEA_TOKEN" ]; then
|
||||
echo "ERROR: CI_TOKEN secret is not set!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create release
|
||||
RESPONSE=$(curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.CI_TOKEN }}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"tag_name": "${{ github.ref_name }}",
|
||||
@@ -135,10 +151,9 @@ jobs:
|
||||
for file in dist/*; do
|
||||
filename=$(basename "$file")
|
||||
echo "Uploading $filename..."
|
||||
UPLOAD_RESPONSE=$(curl -X POST \
|
||||
-H "Authorization: token ${{ secrets.CI_TOKEN }}" \
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"$file" \
|
||||
"https://git.salastil.com/api/v1/repos/Salastil/Sneedchat-Discord-Bridge-Go/releases/$RELEASE_ID/assets?name=$filename")
|
||||
echo "Upload response for $filename: $UPLOAD_RESPONSE"
|
||||
"https://git.salastil.com/api/v1/repos/Salastil/Sneedchat-Discord-Bridge-Go/releases/$RELEASE_ID/assets?name=$filename"
|
||||
done
|
||||
Reference in New Issue
Block a user