Skip to content

Commit

Permalink
refactor: use github action core for logging (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezanet authored May 8, 2023
1 parent 04c0a64 commit 2e554c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# Publish
- name: publish on version change
id: publish_nuget
uses: alirezanet/publish-nuget@v3.0.0
uses: alirezanet/publish-nuget@v3.1.0
with:
# Filepath of the project to be packaged, relative to root of repository
PROJECT_FILE_PATH: Core/Core.csproj
Expand Down
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const os = require("os"),
fs = require("fs"),
path = require("path"),
core = require('@actions/core'),
https = require("https"),
spawnSync = require("child_process").spawnSync

Expand Down Expand Up @@ -43,7 +44,7 @@ class Action {
this._executeInProcess(`git tag ${TAG}`)
this._executeInProcess(`git push origin ${TAG}`)

process.stdout.write(`::set-output name=VERSION::${TAG}` + os.EOL)
core.setOutput('VERSION', TAG);
}

_pushPackage(version, name) {
Expand Down Expand Up @@ -78,12 +79,12 @@ class Action {
const packageFilename = packages.filter(p => p.endsWith(".nupkg"))[0],
symbolsFilename = packages.filter(p => p.endsWith(".snupkg"))[0]

process.stdout.write(`::set-output name=PACKAGE_NAME::${packageFilename}` + os.EOL)
process.stdout.write(`::set-output name=PACKAGE_PATH::${path.resolve(packageFilename)}` + os.EOL)
core.setOutput('PACKAGE_NAME', packageFilename);
core.setOutput('PACKAGE_PATH', path.resolve(packageFilename));

if (symbolsFilename) {
process.stdout.write(`::set-output name=SYMBOLS_PACKAGE_NAME::${symbolsFilename}` + os.EOL)
process.stdout.write(`::set-output name=SYMBOLS_PACKAGE_PATH::${path.resolve(symbolsFilename)}` + os.EOL)
core.setOutput('SYMBOLS_PACKAGE_NAME', symbolsFilename);
core.setOutput('SYMBOLS_PACKAGE_PATH', path.resolve(symbolsFilename));
}

if (this.tagCommit)
Expand All @@ -106,7 +107,7 @@ class Action {
console.log('404 response, assuming new package')
this._pushPackage(this.version, this.packageName)
}


if (res.statusCode == 200) {
res.setEncoding("utf8")
Expand Down

0 comments on commit 2e554c8

Please sign in to comment.