Modify forgejo release to target our own runner
Some checks failed
release / build (push) Failing after 1m19s
Some checks failed
release / build (push) Failing after 1m19s
This commit is contained in:
parent
5b890b18e4
commit
02fd358611
1 changed files with 29 additions and 11 deletions
|
|
@ -1,12 +1,14 @@
|
||||||
name: release
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
push:
|
||||||
types: [published]
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: codeberg-small
|
runs-on: ubuntu-latest
|
||||||
|
container: catthehacker/ubuntu:act-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
@ -35,16 +37,32 @@ jobs:
|
||||||
|
|
||||||
- name: Upload to release
|
- name: Upload to release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
RELEASE_ID="${{ github.event.release.id }}"
|
TAG="${{ github.ref_name }}"
|
||||||
API_URL="${{ github.api_url }}/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets"
|
API_BASE="${{ github.server_url }}/api/v1"
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
|
||||||
|
# check if release exists
|
||||||
|
RELEASE_ID=$(curl -sf \
|
||||||
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
|
"${API_BASE}/repos/${REPO}/releases/tags/${TAG}" | jq -r '.id // empty')
|
||||||
|
|
||||||
|
if [ -z "$RELEASE_ID" ]; then
|
||||||
|
echo "Creating release for ${TAG}..."
|
||||||
|
RELEASE_ID=$(curl -sf \
|
||||||
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"tag_name":"'"${TAG}"'","name":"'"${TAG}"'"}' \
|
||||||
|
"${API_BASE}/repos/${REPO}/releases" | jq -r '.id')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Release ID: ${RELEASE_ID}"
|
||||||
|
|
||||||
for file in lofivor-linux-x86_64 lofivor-windows-x86_64.exe; do
|
for file in lofivor-linux-x86_64 lofivor-windows-x86_64.exe; do
|
||||||
echo "Uploading $file..."
|
echo "Uploading $file..."
|
||||||
curl -X POST \
|
curl -sf \
|
||||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-F "attachment=@${file}" \
|
||||||
--data-binary @"$file" \
|
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${file}"
|
||||||
"${API_URL}?name=${file}"
|
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue