Switch forgejo to ubuntu-latest runner
Some checks failed
release / build (push) Failing after 2m31s
Some checks failed
release / build (push) Failing after 2m31s
This commit is contained in:
parent
5b890b18e4
commit
2e277a7c38
1 changed files with 35 additions and 9 deletions
|
|
@ -3,10 +3,19 @@ name: release
|
|||
on:
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag name for release (creates tag at HEAD)'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: codeberg-small
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
@ -35,16 +44,33 @@ jobs:
|
|||
|
||||
- name: Upload to release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
run: |
|
||||
RELEASE_ID="${{ github.event.release.id }}"
|
||||
API_URL="${{ github.api_url }}/repos/${{ github.repository }}/releases/${RELEASE_ID}/assets"
|
||||
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
||||
API_BASE="${{ github.server_url }}/api/v1"
|
||||
REPO="${{ github.repository }}"
|
||||
|
||||
# get or create release
|
||||
RELEASE_ID=$(curl -sf \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
"${API_BASE}/repos/${REPO}/releases/tags/${TAG}" | jq -r '.id')
|
||||
|
||||
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||
echo "Creating release for ${TAG}..."
|
||||
RELEASE_ID=$(curl -sf -X POST \
|
||||
-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}"
|
||||
|
||||
# upload assets
|
||||
for file in lofivor-linux-x86_64 lofivor-windows-x86_64.exe; do
|
||||
echo "Uploading $file..."
|
||||
curl -X POST \
|
||||
-H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"$file" \
|
||||
"${API_URL}?name=${file}"
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
-F "attachment=@${file}" \
|
||||
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${file}"
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in a new issue