Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push from non-tag triggered workflows if name is specified #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Alkrun
Copy link

@Alkrun Alkrun commented Jan 8, 2020

The change here is to not require a tag-triggered workflow if the name input is passed to action-gh-release.

Resolves: #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 }}

@Alkrun
Copy link
Author

Alkrun commented Jan 8, 2020

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 npm@6.11.3
3 info using node@v12.11.1
4 verbose run-script [ 'prefmt', 'fmt', 'postfmt' ]
5 info lifecycle action-gh-release@0.1.5~prefmt: action-gh-release@0.1.5
6 info lifecycle action-gh-release@0.1.5~fmt: action-gh-release@0.1.5
7 verbose lifecycle action-gh-release@0.1.5~fmt: unsafe-perm in lifecycle true
8 verbose lifecycle action-gh-release@0.1.5~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 action-gh-release@0.1.5~fmt: CWD: C:\action-gh-release
10 silly lifecycle action-gh-release@0.1.5~fmt: Args: [ '/d /s /c', "prettier --write 'src/**/*.ts' '__tests__/**/*.ts'" ]
11 silly lifecycle action-gh-release@0.1.5~fmt: Returned: code: 2  signal: null
12 info lifecycle action-gh-release@0.1.5~fmt: Failed to exec fmt script
13 verbose stack Error: action-gh-release@0.1.5 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 action-gh-release@0.1.5
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 action-gh-release@0.1.5 fmt: `prettier --write 'src/**/*.ts' '__tests__/**/*.ts'`
22 error Exit status 2
23 error Failed at the action-gh-release@0.1.5 fmt script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

@softprops
Copy link
Owner

I just saw this pull after #39. Does that also solve the solve for this case as well?

@Alkrun
Copy link
Author

Alkrun commented Jan 9, 2020

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?

@k-takata
Copy link
Contributor

k-takata commented Jan 9, 2020

npm run fmtcheck is failing, but so is npm 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.

@Alkrun
Copy link
Author

Alkrun commented Jan 13, 2020

I'll check out that other pull request today or tomorrow and close this pull request if that covers my case.

@eitsupi
Copy link

eitsupi commented Sep 11, 2021

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub Releases requires a tag
4 participants