cake icon indicating copy to clipboard operation
cake copied to clipboard

Github Actions: UploadArtifact does not result in uploaded artifact

Open Sebazzz opened this issue 1 year ago • 4 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched issues to ensure it has not already been reported

Cake runner

Cake runner for .NET Core

Cake version

4.0.0

Operating system

Windows

Operating system architecture

64-Bit

CI Server

Github Actions

What are you seeing?

Artifact is not showing up at end of the build, but no exception is raised either. Simply nothing happens, as if the call to UploadArtifact isn't there.

What is expected?

Artifact appears at the end of the run

Steps to Reproduce

  • I'm running Cake through a bootstrap script, not through the cake action, for instance:
- name: Build - Publish package
   run: .\build.cmd -target package -configuration release -verbosity verbose
GitHubActions.Commands.UploadArtifact(MakeAbsolute(targetFilePath), artifactName);

with parameters:

  • targetFilePath = build/my-package-3.2.0-alpha1-gbc9a15817f.zip
  • artifactName = my-package-3.2.0-alpha1-gbc9a15817f.zip

Output log

========================================
Create-PackageZip
========================================
Executing task: Create-PackageZip
Moving directory out to D:/a/corp-my-package/corp-my-package/build/forge-out
Used branch information 'refs/heads/develop' to determine if this is a public release: False. Use the -PublicRelease parameter to override.
Executing: "D:/a/corp-my-package/corp-my-package/tools/7-Zip.CommandLine.18.1.0/tools/x64/7za.exe" a -tzip "build/my-package-3.2.0-alpha1-gfc1964d21d.zip" "D:/a/corp-my-package/corp-my-package/build/forge-out/my-package-win32-x64"
ESEF reader has been packaged to location: build/my-package-3.2.0-alpha1-gfc1964d21d.zip
Finished executing task: Create-PackageZip

Sebazzz avatar Aug 16 '24 08:08 Sebazzz

It's an async method do you await it? Example: https://github.com/cake-build/cake/blob/06e82a78bb8bfa978bcf838100caf69f1157cbdd/tests/integration/Cake.Common/Build/GitHubActions/GitHubActionsProvider.cake#L114

devlead avatar Aug 16 '24 08:08 devlead

No I don't. I didn't notice in the docs it returns a task, but it does so I guess I ignored that.

Sebazzz avatar Aug 16 '24 08:08 Sebazzz

Unfortunately, that brings me one step closer:

GitHub Actions Runtime Token missing

I'm not using Cake frosting. Is the Github Cake step mandatory? I'm unable to use it in my repository due to security constraints.

Sebazzz avatar Aug 16 '24 09:08 Sebazzz

https://github.com/cake-build/cake-action is needed as regular GitHub action script task doesn't include needed variables from the environment. For security concerns it's recommended to pin to a specific commit or you fork and reference the code to a repository controlled by your org.

devlead avatar Aug 16 '24 11:08 devlead