feat: Update build workflows for Catalog Lite and Windows Avalonia with improved input types and release handling
Some checks failed
Build Windows Avalonia / build (push) Failing after 1m43s
Some checks failed
Build Windows Avalonia / build (push) Failing after 1m43s
This commit is contained in:
parent
50f0209eb9
commit
3fea86fa78
3 changed files with 185 additions and 90 deletions
|
|
@ -5,10 +5,13 @@ on:
|
|||
branches:
|
||||
- master
|
||||
- develop
|
||||
tags:
|
||||
- '*'
|
||||
paths-ignore:
|
||||
- 'CatalogLite/**'
|
||||
paths:
|
||||
- '.forgejo/workflows/build-windows-avalonia.yml'
|
||||
- 'Catalog.Communication/**'
|
||||
- 'GitVersion.yml'
|
||||
- 'NuGet.Config'
|
||||
- 'MaddoShared/**'
|
||||
- 'imagecatalog/**'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
|
|
@ -95,80 +98,3 @@ jobs:
|
|||
path: ${{ env.PUBLISH_DIR }}
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
needs: build
|
||||
runs-on: docker
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
|
||||
steps:
|
||||
- name: Download publish artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME }}
|
||||
path: artifacts/release
|
||||
|
||||
- name: Validate release token
|
||||
run: |
|
||||
set -eu
|
||||
if [ -z "${FORGEJO_TOKEN}" ]; then
|
||||
echo "secrets.FORGEJO_TOKEN is required for tagged releases"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Create or reuse release
|
||||
run: |
|
||||
set -eu
|
||||
api_base="${GITHUB_SERVER_URL%/}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||
tag="${GITHUB_REF_NAME}"
|
||||
|
||||
http_code="$(curl -sS -o release.json -w '%{http_code}' \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
"${api_base}/releases/tags/${tag}")"
|
||||
|
||||
if [ "${http_code}" = "200" ]; then
|
||||
release_id="$(sed -n 's/.*"id":\([0-9][0-9]*\).*/\1/p' release.json | head -n1)"
|
||||
elif [ "${http_code}" = "404" ]; then
|
||||
payload="$(printf '{"tag_name":"%s","name":"%s","draft":false,"prerelease":false}' "${tag}" "${tag}")"
|
||||
curl -fsS \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d "${payload}" \
|
||||
"${api_base}/releases" \
|
||||
-o release.json
|
||||
release_id="$(sed -n 's/.*"id":\([0-9][0-9]*\).*/\1/p' release.json | head -n1)"
|
||||
else
|
||||
echo "Unexpected response while loading release for tag ${tag}: ${http_code}"
|
||||
cat release.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${release_id}" ]; then
|
||||
echo "Unable to resolve Forgejo release id"
|
||||
cat release.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "RELEASE_ID=${release_id}" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Upload executable to release
|
||||
run: |
|
||||
set -eu
|
||||
api_base="${GITHUB_SERVER_URL%/}/api/v1/repos/${GITHUB_REPOSITORY}"
|
||||
executable_path="$(find artifacts/release -maxdepth 1 -type f -iname '*.exe' | head -n1)"
|
||||
|
||||
if [ -z "${executable_path}" ]; then
|
||||
echo "No executable found in downloaded artifact"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
short_sha="$(printf '%s' "${GITHUB_SHA}" | cut -c1-12)"
|
||||
asset_name="ImageCatalog-avalonia-win-x64-${GITHUB_REF_NAME}-${short_sha}.exe"
|
||||
|
||||
curl -fsS \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"${executable_path}" \
|
||||
"${api_base}/releases/${RELEASE_ID}/assets?name=${asset_name}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue