-
-
Notifications
You must be signed in to change notification settings - Fork 104
Description
OS
Windows, Debian, Ubuntu, Forgejo 12
Programming Language
dotnet 9
VPK Version
vpk 0.0.1298, vpk 0.0.1350-g3ba32af
Library Version
Nuget v0.0.1298
What happened?
Hi 👋,
Recently I stumped upon this nice project which seems really straightforward to use 😄. However I cannot seem to upload a release to Forgejo with the built-in Gitea API.
I first tried this with Gitea Actions, because that would be my preferred way of packing my app and uploading it to the Forgejo API.
Build and publish Velopack app
This is the workflow that I tried to use to package and publish my application.
name: Build and publish Velopack app
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build and publish
runs-on: ubuntu-latest
timeout-minutes: 30
env:
VPK_REPO_URL: "https://my.forgejo/${{ github.repository }}"
VPK_OUTPUT_DIR: "./publish/"
VPK_TOKEN: ${{ github.token }}
strategy:
fail-fast: true
matrix:
platform:
- os: win
rid: win-x64
steps:
- name: ⤵️ Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0 # Needed for nbgv
- name: Setup dotnet
# yamllint disable-line rule:line-length
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_INSTALL_DIR: "/opt/hostedtoolcache/dotnet"
- name: Setup nuget cache
id: setup-nuget-cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: |
${{ github.workspace }}/.nuget/packages
~/.nuget/packages
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: 📦 Restore nuget packages
run: dotnet restore --locked-mode
- name: 🏗️ Install Velopack
run: dotnet tool install -g vpk
- name: 🔖 Run Nerdbank GitVersioning
id: nbgv
uses: dotnet/nbgv@master
- name: 👷 Build and Publish
run: |
dotnet publish -c Release \
-r ${{ matrix.platform.rid }} \
--self-contained=true
- name: ⬇️ Download previous release
run: |
vpk download gitea --outputDir "$VPK_OUTPUT_DIR" \
--channel "$VPK_CHANNEL" \
--repoUrl "$VPK_REPO_URL" \
--token "$VPK_TOKEN"
env:
VPK_CHANNEL: "${{ matrix.platform.os }}"
- name: 👷 Package published release
run: |
VPK_PARAMS=(--outputDir="$VPK_OUTPUT_DIR")
VPK_PARAMS+=(--packId="$VPK_PACK_ID")
VPK_PARAMS+=(--packVersion="$VPK_PACK_VERSION")
VPK_PARAMS+=(--packDir="$VPK_PACK_DIR")
VPK_PARAMS+=(--packAuthors="$VPK_PACK_AUTHORS")
VPK_PARAMS+=(--packTitle="$VPK_PACK_TITLE")
if [[ "$PLATFORM" == "win" ]]; then
VPK_PARAMS+=(--mainExe="${VPK_MAIN_EXE}.exe")
VPK_PARAMS+=(--noPortable)
VPK_PARAMS+=(--shortcuts="$VPK_SHORTCUTS")
else
VPK_PARAMS+=(--mainExe="$VPK_MAIN_EXE")
fi
vpk "[$PLATFORM]" pack "${VPK_PARAMS[@]}"
env:
PLATFORM: "${{ matrix.platform.os }}"
VPK_PACK_ID: "alex3305.desktopcompanion"
VPK_PACK_VERSION: "${{ steps.nbgv.outputs.SemVer2 }}"
VPK_PACK_DIR: "./dist/${{ matrix.platform.rid }}"
VPK_PACK_AUTHORS: "alex3305"
VPK_PACK_TITLE: "Desktop Companion"
VPK_MAIN_EXE: "DesktopCompanion"
VPK_NO_PORTABLE: true
VPK_SHORTCUTS: "Desktop,Startup,StartMenuRoot"
- name: 🚀 Upload updated release
run: |
vpk upload gitea --outputDir "$VPK_OUTPUT_DIR" \
--channel "$VPK_CHANNEL" \
--repoUrl "$VPK_REPO_URL" \
--token "$VPK_TOKEN" \
--publish \
--releaseName "$VPK_RELEASE_NAME" \
--tag "$VPK_TAG" \
--targetCommitish "$VPK_TARGET_COMMITISH"
env:
VPK_CHANNEL: "${{ matrix.platform.os }}"
# yamllint disable-line rule:line-length
VPK_RELEASE_NAME: "Desktop Companion ${{ steps.nbgv.outputs.SemVer2 }}"
VPK_TAG: "v${{ steps.nbgv.outputs.SemVer2 }}"
VPK_TARGET_COMMITISH: "${{ github.SHA }}"Note
My ubuntu-latest image internally refers to ghcr.io/catthehacker/ubuntu:act-24.04
Important
Although I refer to my.forgejo, this is a placeholder. In reality this URL actually resolves to a valid, public URL with a valid certificate.
Where every step works except uploading. This yields an ApiException:
[19:08:28 INF] Velopack CLI 0.0.1298, for distributing applications.
[19:08:28 INF] Preparing to upload 2 asset(s) to Gitea
[19:08:29 INF] Creating draft release titled 'Desktop Companion 1.0.57-beta.gcc060ceb45'
[19:08:29 FTL] Error calling RepoCreateRelease: {"message":"token is required","url":"https://my.forgejo/api/swagger"}
Gitea.Net.Client.ApiException: Error calling RepoCreateRelease: {"message":"token is required","url":"https://my.forgejo/api/swagger"}
at Gitea.Net.Api.RepositoryApi.RepoCreateReleaseWithHttpInfoAsync(String owner, String repo, CreateReleaseOption body, Int32 operationIndex, CancellationToken cancellationToken)
at Gitea.Net.Api.RepositoryApi.RepoCreateReleaseAsync(String owner, String repo, CreateReleaseOption body, Int32 operationIndex, CancellationToken cancellationToken)
at Velopack.Deployment.GiteaRepository.UploadMissingAssetsAsync(GiteaUploadOptions options) in ./vpk/Velopack.Deployment/GiteaRepository.cs:line 131
at Velopack.Vpk.ProgramCommandExtensions.<>c__DisplayClass3_0`2.<<Add>b__0>d.MoveNext() in ./vpk/Velopack.Vpk/Program.cs:line 272
However downloading works perfectly fine.
[19:08:11 INF] Velopack CLI 0.0.1298, for distributing applications.
[19:08:12 INF] Fetching releases for channel win...
[19:08:12 WRN] No releases found at 'https://my.forgejo/alex/DesktopCompanion'.
[19:08:12 INF] Found 0 release(s) in remote file
[19:08:12 WRN] No full / applicable release was found to download. Aborting.
I also tried to use an explicit token instead of the generated github.token which I normally use for publishing on my internal Nuget package register:
env:
- VPK_TOKEN: ${{ github.token }}
+ VPK_TOKEN: ${{ secrets.NUGET_PASSWORD }}But that gives the same error. While providing an invalid token yields me a different, unauthorized error:
$ vpk download gitea --token TEST --repoUrl "https://my.forgejo/alex/DesktopCompanion"
[10:56:03 INF] Velopack CLI 0.0.1298, for distributing applications.
[10:56:04 INF] Fetching releases for channel win...
[10:56:04 ERR]
Response status code does not indicate success: 401 (Unauthorized)., retrying in 1 second.
[10:56:05 INF] (retry 1) Fetching releases for channel win...
[10:56:05 ERR]
Response status code does not indicate success: 401 (Unauthorized)., retrying in 1 second.
[10:56:06 INF] (retry 2) Fetching releases for channel win...
[10:56:06 ERR]
Response status code does not indicate success: 401 (Unauthorized)., will not try again.
[10:56:06 FTL] Response status code does not indicate success: 401 (Unauthorized).
HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
at HttpResponseMessage EnsureSuccessStatusCode()
at async Task<string> GetStringAsyncCore(HttpRequestMessage request, CancellationToken
cancellationToken)
at async Task<T> TryDownloadThenLowercase<T>(Func<string, Task<T>> downloadFunc, string url
) in HttpClientFileDownloader.cs:58
at async Task<T> TryDownloadThenLowercase<T>(Func<string, Task<T>> downloadFunc, string url
) in HttpClientFileDownloader.cs:68
at async Task<string> DownloadString(string url, IDictionary<string, string> headers,
double timeout) in HttpClientFileDownloader.cs:47
at async Task<GiteaRelease[[]]> GetReleases(bool includePrereleases) in GiteaSource.cs:100
at async Task<VelopackAssetFeed> GetReleaseFeed(IVelopackLogger logger, string appId,
string channel, Guid? stagingId, VelopackAsset latestLocalRelease) in GitBase.cs:76
at async Task<T> RetryAsyncRet<T>(Func<Task<T>> block, string message, int maxRetries) in
_Repository.cs:123
at async Task<T> RetryAsyncRet<T>(Func<Task<T>> block, string message, int maxRetries)
at async Task DownloadLatestFullPackageAsync(TDown options) in _Repository.cs:66
at void MoveNext() in Program.cs:272
Local deployment
So instead of trying from Forgejo Actions, I tried using my workstation for deployment. But unfortunately I get stuck at the same place
$ VPK_TOKEN="1010fd9d123bc557c4987367b19af29b12343305"
$ dotnet publish -c="Release" -r="win-x64" --self-contained="true"
Restore complete (1.6s)
DesktopCompanion.Plugin succeeded (1.8s) → src/DesktopCompanion.Plugin/bin/Release/net9.0/win-x64/publish/
DesktopCompanion.Plugin.CurrentUser succeeded (1.3s) → dist/win-x64/plugins/
DesktopCompanion.Plugin.Display succeeded (1.3s) → dist/win-x64/plugins/
DesktopCompanion.Plugin.Audio succeeded (1.9s) → dist/win-x64/plugins/
DesktopCompanion.Plugin.Hostname succeeded (1.7s) → dist/win-x64/plugins/
DesktopCompanion succeeded (1.1s) → dist/win-x64/
[!INFO]
Of course the token above is fake 😉 .
which packages my app in the ./dist/ folder. After that I can check for existing packages and (cross-)compile package my app with Velopack:
$ vpk download gitea --verbose --outputDir="./publish/" --channel="win" --repoUrl="https://my.forgejo/alex/DesktopCompanion" --token="$VPK_TOKEN"
[11:09:46 INF] Velopack CLI 0.0.1350-g3ba32af (prerelease), for distributing applications.
[11:09:47 DBG] vpk is up to date (latest online = 0.0.1350-g3ba32af)
[11:09:47 INF] Fetching releases for channel win...
[11:09:47 WRN] No releases found at 'https://my.forgejo/alex/DesktopCompanion'.
[11:09:47 INF] Found 0 release(s) in remote file
[11:09:47 WRN] No full / applicable release was found to download. Aborting.
[11:09:47 DBG] vpk is up to date (latest online = 0.0.1350-g3ba32af)
$ vpk "[win]" pack --outputDir="./publish/" --packId="alex3305.DesktopCompanion" --packVersion="1.0.58-beta.gf245125705" --packDir="./dist/win-x64" --packAuthors="alex3305" --packTitle="Desktop Companion" --mainExe="Main.exe" --noPortable --shortcuts="Desktop,Startup,StartMenuRoot"
[11:10:34 INF] Directive enabled for cross-compiling from Linux (current os) to Windows.
[11:10:35 INF] Velopack CLI 0.0.1350-g3ba32af (prerelease), for distributing applications.
[11:10:35 INF] Beginning to package Velopack release 1.0.58-beta.gf245125705.
[11:10:35 INF] Releases Directory: /mnt/c/Users/Alex/RiderProjects/DesktopCompanion/publish/
[11:10:46 INF]
Verified VelopackApp.Run() in 'System.Void DesktopCompanion.Program::Main(System.String)'.
[11:10:52 WRN] No signing parameters provided, 1 file(s) will not be signed.
Pre-process steps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 00:00:03
Code-sign application ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% 00:00:00
Building release 1.0.58-beta.gf245125705 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 00:00:03
Building setup package ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 00:00:00
Post-process steps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 00:00:01
[11:10:54 INF] Finished in 00:00:08.3479010.
And finally uploading, where I get stuck again 😢
$ vpk upload gitea --verbose --outputDir="./publish/" --channel="win" --repoUrl="https://my.forgejo/alex/DesktopCompanion" --token="$VPK_TOKEN" --publish --releaseName="My App 1.0.58-beta.gf245125705" --tag="v1.0.58-beta.gf245125705"
[11:12:16 INF] Velopack CLI 0.0.1350-g3ba32af (prerelease), for distributing applications.
[11:12:16 DBG] vpk is up to date (latest online = 0.0.1350-g3ba32af)
[11:12:17 INF] Preparing to upload 2 asset(s) to Gitea
[11:12:17 INF] Creating draft release titled 'Desktop Companion 1.0.58-beta.gf245125705'
[11:12:17 FTL]
Error calling RepoCreateRelease: {"message":"token is
required","url":"https://my.forgejo/api/swagger"}
ApiException: Error calling RepoCreateRelease: {"message":"token is
required","url":"https://my.forgejo/api/swagger"}
at async Task<ApiResponse<Release>> RepoCreateReleaseWithHttpInfoAsync(string owner, string
repo, CreateReleaseOption body, int operationIndex, CancellationToken cancellationToken)
at async Task<Release> RepoCreateReleaseAsync(string owner, string repo,
CreateReleaseOption body, int operationIndex, CancellationToken cancellationToken)
at async Task UploadMissingAssetsAsync(GiteaUploadOptions options) in GiteaRepository.cs:
131
at void MoveNext() in Program.cs:272
Is this a known incompatibility? Or is there anything else I miss or can try?