Add more binary builds, simplify release process#276
Conversation
Now that there is a ZIP archive to download, to avoid the complexities of unzipping through Node.js we use hub to download the `.zip`, extract it, and eventually upload the `.msi` back to the release.
|
|
||
| - name: Check out code into the Go module directory | ||
| uses: actions/checkout@v1 | ||
| uses: actions/checkout@v2 |
There was a problem hiding this comment.
checkout@v2 is faster and has more features than checkout@v1, such as easy pushing back to the repository
| - name: Generate changelog | ||
| run: script/changelog | tee CHANGELOG.md | ||
| run: | | ||
| git fetch --unshallow |
There was a problem hiding this comment.
This is needed when generating changelog since checkout@v2 is shallow by default
| GH_OAUTH_CLIENT_ID: 178c6fc778ccc68e1d6a | ||
| GH_OAUTH_CLIENT_SECRET: ${{secrets.OAUTH_CLIENT_SECRET}} | ||
| GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
| GITHUB_TOKEN: ${{secrets.UPLOAD_GITHUB_TOKEN}} |
There was a problem hiding this comment.
goreleaser now needs to also write to github/homebrew-gh directly, so regular GITHUB_TOKEN won't suffice as it only has privileges to write to this repo
| shell: bash | ||
| run: | | ||
| curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1 | ||
| bin/hub release download "${GITHUB_REF#refs/tags/}" -i '*windows_amd64*.zip' |
There was a problem hiding this comment.
Now that we're uploading .zip instead of .exe to our relases, I found myself struggling to update the download-exe action accordingly. Instead, I've opted to use hub to make downloading and extracting simpler.
| mkdir -p build | ||
| msi="$(basename "${{ steps.download_exe.outputs.zip }}" ".zip").msi" | ||
| printf "::set-output name=msi::%s\n" "$msi" | ||
| go-msi make --msi "$PWD/$msi" --out "$PWD/build" --version "${GITHUB_REF#refs/tags/}" |
There was a problem hiding this comment.
Now that the download_exe has changed and already extracts bin/hub.exe in the appropriate place, I've decided to inline the build MSI script since most of what it does is just invokes go-msi with appropriate arguments.
| with: | ||
| msi-file: ${{ steps.buildmsi.outputs.msi }} | ||
| shell: bash | ||
| run: bin/hub release edit "${GITHUB_REF#refs/tags/}" -m "" -a "${{ steps.buildmsi.outputs.msi }}" |
There was a problem hiding this comment.
Since the upload MSI step only needs to upload a single file and is no longer responsible for deleting the old .exe, I've chosen to just do a hub one-liner here to replace the JS action.
| id: macos | ||
| goos: [darwin] | ||
| goarch: [amd64] | ||
| - <<: *build_defaults |
There was a problem hiding this comment.
I'm using arcane YAML trickery here to avoid repeating binary, main, and ldflags fields for each of the builds
|
|
||
| brews: | ||
| - name: gh | ||
| ids: [nix] |
There was a problem hiding this comment.
Homebrew now includes binaries from both macos+linux builds
This adds
.zipinstead of.exefor WindowsI have chosen to provide
.ziparchives for Windows to enable bundling more files with a release for the future, such as HTML help files. Providing.ziparchives also enables scripted installs such as via community-maintained Chocolatey/Scoop formulas in the long term, whereas I doubt that scripts are able to fetch & unpack files from MSI installers in the same way.This PR changes
github/homebrew-ghas there is no need for that anymore;