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

Configure placement of binary in archive. #3215

Closed
2 tasks done
nathanhammond opened this issue Jun 29, 2022 · 3 comments · Fixed by #3261
Closed
2 tasks done

Configure placement of binary in archive. #3215

nathanhammond opened this issue Jun 29, 2022 · 3 comments · Fixed by #3261
Assignees
Labels
enhancement New feature or request

Comments

@nathanhammond
Copy link
Contributor

nathanhammond commented Jun 29, 2022

Is your feature request related to a problem? Please describe.

I would like to be able to control the placement of the binary within the archive separately from placement within dist.

builds:
  - id: turbo
    main: ./cmd/turbo
    binary: subdir/turbo
archives:
  - id: default
    wrap_in_directory: true
    files:
      - LICENSE
      - README.md

Archive output:

turbo-1.3.2-windows_arm64/LICENSE
turbo-1.3.2-windows_arm64/README.md
turbo-1.3.2-windows_arm64/subdir/turbo.exe
                          ^^^^^^

In many cases this is fine but if I want to toggle no_unique_dist_dir and then use the binary property to reimplement a different "unique" structure, the entirety of that path appears in the archive.

builds:
  - id: turbo
    main: ./cmd/turbo
    no_unique_dist_dir: true
    binary: turbo-{{.Os}}-{{ if (eq .Arch "amd64") }}64{{ end }}{{ if not (eq .Arch "amd64") }}{{ if (eq .Arch "386") }}32{{ end }}{{ if not (eq .Arch "386") }}{{ .Arch }}{{ end }}{{ end }}{{ if not (eq .Ext ".exe") }}/bin{{ end }}/turbo
archives:
  - id: default
    wrap_in_directory: true
    files:
      - LICENSE
      - README.md

Archive output:

turbo-1.3.2-windows_arm64/LICENSE
turbo-1.3.2-windows_arm64/README.md
turbo-1.3.2-windows_arm64/turbo-windows-arm64/turbo.exe
                          ^^^^^^^^^^^^^^^^^^^

Describe the solution you'd like

I'd propose a new binary key inside of the archive object which enables me to specify the name relative to the root of the produced archive.

(Aside: currently Ext isn't plumbed through to archives templates.)

archives:
  - id: default
    wrap_in_directory: true
    binary: turbo{{ .Ext }}
    files:
      - LICENSE
      - README.md

Archive output:

turbo-1.3.2-windows_arm64/LICENSE
turbo-1.3.2-windows_arm64/README.md
turbo-1.3.2-windows_arm64/turbo.exe

Describe alternatives you've considered

One attempted workaround which almost does what I want:

archives:
  - id: default
    wrap_in_directory: true
    files:
      - LICENSE
      - README.md
      - src: dist/turbo-{{.Os}}-{{ if (eq .Arch "amd64") }}64{{ end }}{{ if not (eq .Arch "amd64") }}{{ if (eq .Arch "386") }}32{{ end }}{{ if not (eq .Arch "386") }}{{ .Arch }}{{ end }}{{ end }}{{ if (eq .Os "windows") }}/turbo.exe{{ end }}{{ if not (eq .Os "windows") }}/bin/turbo{{ end }}
        dst: .
        strip_parent: true

This enables me to place the asset where I want it; but I am unable to prevent the addition of the binary at the full path:

Archive output:

turbo-1.3.2-windows_arm64/LICENSE
turbo-1.3.2-windows_arm64/README.md
turbo-1.3.2-windows_arm64/turbo.exe
turbo-1.3.2-windows_arm64/turbo-windows-arm64/turbo.exe
                          ^^^^^^^^^^^^^^^^^^^

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

meta: true in the archive immediately breaks because it is no longer per-build.

@nathanhammond nathanhammond added enhancement New feature or request triage Issue pending triage by one of the maintainers labels Jun 29, 2022
@caarlos0
Copy link
Member

an archive can have multiple binaries... maybe a different approach:

archives:
  - id: default
    wrap_in_directory: true
    strip_binary_parent_dir: true # this
    files:
      - LICENSE
      - README.md

wdyt?

@caarlos0
Copy link
Member

btw, I wonder why do you need binary: subdir/turbo?

in any case, check #3261

@caarlos0 caarlos0 removed the triage Issue pending triage by one of the maintainers label Aug 12, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants