Github-release golang artifacts

Hi!

I’m quite new to drone but I already fell in love with!

The point I’m currently struggling with are github releases.
Using the following pipeline the resulting ‘my_go_program’ nevers gets uploaded to github
I’ve also tried things like ‘*’ or '$GOPATH/bin/‘my_go_program’ (also with “”)

I’m certainly doing something wrong, so hopefully someone can point me in the right direction.
using the drone-github-release go binary I am even able to upload artifacts

pipeline:
  build:
    image: golang
    commands:
      - make test
      - make build
      - make install
      
  publish:
    image: plugins/github-release
    secrets: [ github_token ]
    files: my_go_program
    when:
      event: tag
      status: success

I recommend taking a look at the following project and its .drone.yml configuration, which uses the github release plugin:

Note that the my_go_program is a relative path and assumes the binary exists in the current working directory, which is the root of your git repository. It is important to remember that each step in your pipeline is a separate container, and they share a mounted volume (called the workspace). I recommend reading more about it here https://docs.drone.io/pipeline/docker/syntax/workspace/

I’ve also tried things like ‘*’ or '$GOPATH/bin/my_go_program’

The main reason this does not work is because it is a bash expression. The files attribute is a Go string literal (e.g. var files string) which is why environment variables are not expanded. As an aside, the gopath environment variable does not exist in that container (not that it really matters).

@bradrydzewski thank you for your answer and your reply!
basically it was just a “files: …/my-program” :slight_smile:

anyhow I’ll make a feature suggestion that the github-release should fail if it does not find the files rather than creating an empty release