action-gh-release
action-gh-release copied to clipboard
Push from non-tag triggered workflows if name is specified
The change here is to not require a tag-triggered workflow if the name
input is passed to action-gh-release.
Resolves: https://github.com/softprops/action-gh-release/issues/20
Successful branch-triggered workflow: https://github.com/Alkrun/Sidekick/commit/c759ce5b61785628c77274e05a464b43aa34d648/checks?check_suite_id=390802627
I'm probably going to squash my commits from that repo so to preserve the github action workflow it's pasted below. This is a dotnet core project, the Tag
and Release
steps are probably the only interesting ones related to this pull request:
name: Build
on:
push:
branches:
- 'release/**'
- 'feature/**'
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Setup .NET Core
uses: actions/setup-dotnet@master
with:
dotnet-version: 3.1.100
- name: Version
run: |
dotnet tool install -g gitversion.tool --version 5.1.4-beta1.41
dotnet gitversion /output buildserver
- name: Publish
run: |
dotnet publish ./source/ -r win-x64 -f net48 --configuration Release -p:Version="$env:GitVersion_SemVer" -p:InformationalVersion="$($env:GitVersion_SemVer)-$env.GitVersion_ShortSha" -o ./artifacts/sidekick
Compress-Archive -Path ./artifacts/sidekick -DestinationPath "./artifacts/sidekick-$($env:GitVersion_SemVer).zip"
- name: Tag
if: startsWith(github.ref, 'refs/heads/release/')
run: |
git tag "v$env:GitVersion_SemVer"
git push origin "v$env:GitVersion_SemVer"
- name: Release
#Publish release artifacts for tags only
if: startsWith(github.ref, 'refs/heads/release/')
uses: Alkrun/action-gh-release@nametagfix
with:
name: v${{ env.GitVersion_SemVer }}
prerelease: ${{ env.GitVersion_PreReleaseLabel != '' }}
files: ./artifacts/sidekick-*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm run fmtcheck
is failing, but so is npm run fmt
. Any ideas?
Debug log from npm run fmt
:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'fmt'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prefmt', 'fmt', 'postfmt' ]
5 info lifecycle [email protected]~prefmt: [email protected]
6 info lifecycle [email protected]~fmt: [email protected]
7 verbose lifecycle [email protected]~fmt: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~fmt: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\code\gha\action-gh-release\node_modules\.bin;...
9 verbose lifecycle [email protected]~fmt: CWD: C:\action-gh-release
10 silly lifecycle [email protected]~fmt: Args: [ '/d /s /c', "prettier --write 'src/**/*.ts' '__tests__/**/*.ts'" ]
11 silly lifecycle [email protected]~fmt: Returned: code: 2 signal: null
12 info lifecycle [email protected]~fmt: Failed to exec fmt script
13 verbose stack Error: [email protected] fmt: `prettier --write 'src/**/*.ts' '__tests__/**/*.ts'`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\code\gha\action-gh-release
16 verbose Windows_NT 10.0.19041
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "fmt"
18 verbose node v12.11.1
19 verbose npm v6.11.3
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] fmt: `prettier --write 'src/**/*.ts' '__tests__/**/*.ts'`
22 error Exit status 2
23 error Failed at the [email protected] fmt script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
I just saw this pull after https://github.com/softprops/action-gh-release/pull/39. Does that also solve the solve for this case as well?
I just saw this pull after #39. Does that also solve the solve for this case as well?
Hmm, I thought github release names had to match a tag name? So how would having both a name and a tag_name input parameter work? I see this action can create a draft release so in that case I think you can create the draft release before the tag, but I guess my question would be: If we're using tag_name
what does the name
input do?
npm run fmtcheck
is failing, but so isnpm run fmt
. Any ideas?
On Windows, prettier doesn't seem to accept wildcards.
I had to execute it manually: node_modules\.bin\prettier --write src/main.ts
.
Hmm, I thought github release names had to match a tag name?
Release name and tag name can be different.
I'll check out that other pull request today or tomorrow and close this pull request if that covers my case.
Any update?