This commit is contained in:
parent
6ad3ac8743
commit
a32840c309
1 changed files with 9 additions and 8 deletions
|
|
@ -32,26 +32,27 @@ jobs:
|
|||
chmod +x TinyWeb-linux-x64
|
||||
ls -la TinyWeb-linux-x64
|
||||
|
||||
- name: Create Release
|
||||
- name: Get Release ID
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
id: release
|
||||
run: |
|
||||
TAG="${{ github.ref_name }}"
|
||||
REPO="${{ github.repository }}"
|
||||
TOKEN="${{ secrets.FORGEJO_TOKEN }}"
|
||||
# Try to create release (ignore error if exists)
|
||||
curl -X POST "https://git.derickphan.com/api/v1/repos/$REPO/releases" \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" || true
|
||||
RELEASE_JSON=$(curl -s "https://git.derickphan.com/api/v1/repos/$REPO/releases/tags/$TAG" \
|
||||
-H "Authorization: token $TOKEN")
|
||||
echo "$RELEASE_JSON"
|
||||
RELEASE_ID=$(echo "$RELEASE_JSON" | jq -r '.id')
|
||||
echo "release_id=$RELEASE_ID" >> $FORGEJO_OUTPUT
|
||||
|
||||
- name: Upload to Release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
FILE=TinyWeb-linux-x64
|
||||
TAG="${{ github.ref_name }}"
|
||||
RELEASE_ID="${{ steps.release.outputs.release_id }}"
|
||||
REPO="${{ github.repository }}"
|
||||
TOKEN="${{ secrets.FORGEJO_TOKEN }}"
|
||||
curl -X POST "https://git.derickphan.com/api/v1/repos/$REPO/releases/$TAG/assets" \
|
||||
curl -X POST "https://git.derickphan.com/api/v1/repos/$REPO/releases/$RELEASE_ID/assets" \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-F "attachment=@$FILE"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue