Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

[BUG] Sequential build and publish deleting nuget packages #56

Open
sergeyshaykhullin opened this issue Feb 16, 2021 · 8 comments · Fixed by Elskom/publish-nuget#1 · May be fixed by #61
Open

[BUG] Sequential build and publish deleting nuget packages #56

sergeyshaykhullin opened this issue Feb 16, 2021 · 8 comments · Fixed by Elskom/publish-nuget#1 · May be fixed by #61
Assignees
Labels
bug Something isn't working

Comments

@sergeyshaykhullin
Copy link

sergeyshaykhullin commented Feb 16, 2021

Describe the bug
Each build and push step deletes all nuget packages from previous one

Failed Action Log URL (Required)
https://github.com/appany/AppAny.Quartz.EntityFrameworkCore.Migrations/runs/1913414360?check_suite_focus=true

To Reproduce

  1. Build and publish first package
  2. Build and publish second package
  3. Create release
  4. Try to upload first .nuget to artifacts
  5. BOOM

Expected Behavior
Each build step has its own directory for .nuget files and do not delete previous

The workaround is to reorder steps

Here is the problem

fs.readdirSync(".").filter(fn => /\.s?nupkg$/.test(fn)).forEach(fn => fs.unlinkSync(fn))

Environment:

  • Platform [e.g. Windows / Linux]
  • Action Version [e.g. v2.5.3]
@sergeyshaykhullin sergeyshaykhullin added the bug Something isn't working label Feb 16, 2021
@AraHaan AraHaan linked a pull request May 19, 2021 that will close this issue
@AraHaan
Copy link
Contributor

AraHaan commented May 19, 2021

@sergeyshaykhullin those logs expired.

@AraHaan
Copy link
Contributor

AraHaan commented May 19, 2021

I think a simple fix for this is to remove .forEach(fn => fs.unlinkSync(fn)) since usually people add nupkg's and snupkg's to their .gitignore. If they did not that is their fault if they use an action that commits them to the repository. Wait no I will just change that line to depend on the projectFile variable that it points to on that path.

AraHaan added a commit to AraHaan/publish-nuget that referenced this issue May 19, 2021
@sergeyshaykhullin
Copy link
Author

No, because if you will not delete previous nuget files you will try to push them again

const pushCmd = `dotnet nuget push *.nupkg -s ${this.nugetSource}/v3/index.json -k ${this.nugetKey} --skip-duplicate ${!this.includeSymbols ? "-n 1" : ""}`,

@AraHaan
Copy link
Contributor

AraHaan commented May 19, 2021

So basically I guess one way to fix that is to nuke them after publish.

@sergeyshaykhullin
Copy link
Author

@AraHaan No, i suggest to

Each build step has its own directory for .nuget files and do not delete previous

Randomly generate directories foreach GitHub Action run

So if you have:

- uses: brandedoutcast/publish-nuget@v2
  ...

- uses: brandedoutcast/publish-nuget@v2
  ...

You will have:

.../random/path/1/*.nuget

.../random/path/2/*.nuget

It means that:

  1. _pushPackage should generate random directory
  2. -o { directory }
    this._executeInProcess(`dotnet pack ${this.includeSymbols ? "--include-symbols -p:SymbolPackageFormat=snupkg" : ""} --no-build -c Release ${this.projectFile} -o .`)
  3. push { directory }/*.nuget
    const pushCmd = `dotnet nuget push *.nupkg -s ${this.nugetSource}/v3/index.json -k ${this.nugetKey} --skip-duplicate ${!this.includeSymbols ? "-n 1" : ""}`,
  4. readDirSync('{ directory }')
    const packages = fs.readdirSync(".").filter(fn => fn.endsWith("nupkg"))
  5. Something what i missed

@sergeyshaykhullin
Copy link
Author

Also, as i know, this repo is abandoned

@drusellers What do you think about this changes?

@AraHaan
Copy link
Contributor

AraHaan commented May 19, 2021

I got a better idea and updated #61 accordingly. It might be a bit of a hack however.

@AraHaan
Copy link
Contributor

AraHaan commented May 20, 2021

Alright merged into my fork.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
3 participants