goreleaser / goreleaser-action

GitHub Action for GoReleaser
https://github.com/marketplace/actions/goreleaser-action
MIT License
833 stars 73 forks source link

Question: where are the files built by GoReleaser stored? #439

Closed shawnchapla-8451 closed 8 months ago

shawnchapla-8451 commented 8 months ago

I'm trying to use GoReleaser to create the artifacts for a custom Terraform provider. The provider will be published in our private registry, so I need to manually handle the publishing of the binaries built by GoReleaser. Which means I need to know where they are located so a Bash script in a follow-on GH Actions job can get them.

I've read through the documentation about using the upload-artifact action to save things so they can be accessed by another job, but where are the files produced by GoReleaser when a new tag/release is created (triggering the GHA job), so that the upload action can find them (i.e., where do I set the "path" directive)?

caarlos0 commented 8 months ago

assuming defaults, they are stored under ./dist

you can also read dist/artifacts.json to get the path of each individual binary (there might be more types of files there).

I recommend you run goreleaser locally (e.g. goreleaser release --clean --snapshot) to try it out.

shawnchapla-8451 commented 8 months ago

Thanks for your reply. After running GoReleaser as a GH action, the new files are visible in the releases section of the repo, but there is no ./dist folder accessible by other GHA tasks. I'm using it as documented by HashiCorp:

      - name: Run GoReleaser
        uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
        with:
          version: latest
          args: release --clean
        env:
          # GitHub sets the GITHUB_TOKEN secret automatically.
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
shawnchapla-8451 commented 8 months ago

Never mind ... I'm new to GH Actions so its concept of "scope" is one with which I'm not familiar. I see now that the ./dist folder only exists when the job with the goreleaser task is still "active", then disappears again once the job ends. So any upload of artifacts has to be in that same job.