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