{"id":13496161,"url":"https://github.com/wangyoucao577/go-release-action","last_synced_at":"2025-05-14T19:03:36.657Z","repository":{"id":38413494,"uuid":"245585491","full_name":"wangyoucao577/go-release-action","owner":"wangyoucao577","description":"Automatically publish Go binaries to Github Release Assets through Github Action.","archived":false,"fork":false,"pushed_at":"2024-10-16T13:43:24.000Z","size":167,"stargazers_count":498,"open_issues_count":15,"forks_count":77,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-29T15:22:20.925Z","etag":null,"topics":["action","actions","assets","github-action","github-release","go","golang","release","release-automation"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/go-release-binaries","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wangyoucao577.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-07T07:09:08.000Z","updated_at":"2024-10-14T19:31:01.000Z","dependencies_parsed_at":"2023-12-02T03:29:39.030Z","dependency_job_id":"1596c212-ebf8-4e86-a5a2-9cc8768c403b","html_url":"https://github.com/wangyoucao577/go-release-action","commit_stats":{"total_commits":198,"total_committers":31,"mean_commits":6.387096774193548,"dds":0.1717171717171717,"last_synced_commit":"ada609cca5020e752003fa30119b0d625b0e2ce0"},"previous_names":[],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangyoucao577%2Fgo-release-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangyoucao577%2Fgo-release-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangyoucao577%2Fgo-release-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wangyoucao577%2Fgo-release-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wangyoucao577","download_url":"https://codeload.github.com/wangyoucao577/go-release-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248710404,"owners_count":21149185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","actions","assets","github-action","github-release","go","golang","release","release-automation"],"created_at":"2024-07-31T19:01:43.209Z","updated_at":"2025-04-13T11:45:34.372Z","avatar_url":"https://github.com/wangyoucao577.png","language":"Shell","funding_links":[],"categories":["Shell","Community Resources"],"sub_categories":["Build"],"readme":"# Go Release GitHub Action\n![Build Docker](https://github.com/wangyoucao577/go-release-action/workflows/Build%20Docker/badge.svg) ![PR Build](https://github.com/wangyoucao577/go-release-action/workflows/PR%20Build/badge.svg) [![Test](https://github.com/wangyoucao577/go-release-action/actions/workflows/autotest.yml/badge.svg)](https://github.com/wangyoucao577/go-release-action/actions/workflows/autotest.yml)            \nAutomatically publish `Go` binaries to Github Release Assets through Github Action.\n\n## Features\n- Build `Go` binaries for release and publish to Github Release Assets.\n- Customizable `Go` versions. `latest` by default.\n- Support different `Go` project path in repository.\n- Support multiple binaries in same repository.\n- Customizable binary name.\n- Support multiple `GOOS`/`GOARCH` build in parallel by [Github Action Matrix Strategy](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) gracefully.\n- Publish `.zip` for `windows` and `.tar.gz` for Unix-like OS by default, optionally to disable the compression.\n- No `musl` library dependency issue on `linux`.\n- Support extra command that will be executed before `go build`. You may want to use it to solve dependency if you're NOT using [Go Modules](https://github.com/golang/go/wiki/Modules).\n- Rich parameters support for `go build`(e.g. `-ldflags`, etc.).\n- Support package extra files into artifacts (e.g., `LICENSE`, `README.md`, etc).\n- Support customize build command, e.g., use [packr2](https://github.com/gobuffalo/packr/tree/master/v2)(`packr2 build`) instead of `go build`. Another important usage is to use `make`(`Makefile`) for building on Unix-like systems.\n- Support optional `.md5` along with artifacts.\n- Support optional `.sha256` along with artifacts.\n- Customizable release tag to support publish binaries per `push` or `workflow_dispatch`(manually trigger).\n- Support overwrite assets if it's already exist.\n- Support customizable asset names.\n- Support private repositories.\n- Support executable compression by [upx](https://github.com/upx/upx).\n- Support retry if upload phase fails.    \n- Support build multiple binaries and include them in one package(`.zip/.tar.gz`).       \n\n## Usage\n\n### Basic Example\n\n```yaml\n# .github/workflows/release.yaml\n\non:\n  release:\n    types: [created]\n\npermissions:\n    contents: write\n    packages: write\n\njobs:\n  release-linux-amd64:\n    name: release linux/amd64\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n    - uses: wangyoucao577/go-release-action@v1\n      with:\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        goos: linux\n        goarch: amd64\n```\n\n### Input Parameters\n\n| Parameter | **Mandatory**/**Optional** | Description |\n| --------- | -------- | ----------- |\n| github_token | **Mandatory** | Your `GITHUB_TOKEN` for uploading releases to Github assets. |\n| goos | **Mandatory** | `GOOS` is the running program's operating system target: one of `darwin`, `freebsd`, `linux`, and so on. |\n| goarch | **Mandatory** | `GOARCH` is the running program's architecture target: one of `386`, `amd64`, `arm`, `arm64`, `s390x`, `loong64` and so on. |\n| goamd64 | **Optional** | `GOAMD64` is the running programs amd64 microarchitecture level, which is available since `go1.18`. It should only be used when `GOARCH` is `amd64`: one of `v1`, `v2`, `v3`, `v4`. |\n| goarm | **Optional** | `GOARM` is the running programs arm microarchitecture level, which is available since `go1.1`. It should only be used when `GOARCH` is `arm`: one of `5`, `6`, `7`. |\n| gomips | **Optional** | `GOMIPS` is the running programs arm microarchitecture level, which is available since `go1.13`. It should only be used when `GOMIPS` is one of `mips`, `mipsle`, `mips64`, `mips64le`: one of `hardfloat`, `softfloat`. |\n| goversion |  **Optional** | The `Go` compiler version. `latest`([check it here](https://go.dev/VERSION?m=text)) by default, optional `1.13`, `1.14`, `1.15`, `1.16`, `1.17`, `1.18`, `1.19`. You can also define a specific minor release, such as `1.19.5`. \u003cbr\u003eAlternatively takes a download URL or a path to go.mod instead of version string. Make sure your URL references the `linux-amd64` package. You can find the URL on [Go - Downloads](https://go.dev/dl/).\u003cbr\u003ee.g., `https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz`. |\n| project_path | **Optional** | Where to run `go build`. \u003cbr\u003eUse `.` by default. \u003cbr\u003eIf enable `multi_binaries: true`, you can use `project_path: ./cmd/...` or `project_path: ./cmd/app1 ./cmd/app2` to build multiple binaries and include them in one package.  |\n| binary_name | **Optional** | Specify another binary name if do not want to use repository basename. \u003cbr\u003eUse your repository's basename if not set. |\n| pre_command | **Optional** | Extra command that will be executed before `go build`. You may want to use it to solve dependency if you're NOT using [Go Modules](https://github.com/golang/go/wiki/Modules). |\n| build_command | **Optional** | The actual command to build binary, typically `go build`. You may want to use other command wrapper, e.g., [packr2](https://github.com/gobuffalo/packr/tree/master/v2), example `build_command: 'packr2 build'`. Remember to use `pre_command` to set up `packr2` command in this scenario.\u003cbr\u003eIt also supports the `make`(`Makefile`) building system, example `build_command: make`. In this case both `build_flags` and `ldflags` will be ignored since they should be written in your `Makefile` already. Also, please make sure the generated binary placed in the path where `make` runs, i.e., `project_path`. |\n| executable_compression | **Optional** | Compression executable binary by some third-party tools. It takes compression command with optional args as input, e.g., `upx` or `upx -v`. \u003cbr\u003eOnly [upx](https://github.com/upx/upx) is supported at the moment.|\n| build_flags | **Optional** | Additional arguments to pass the `go build` command. |\n| ldflags | **Optional** | Values to provide to the `-ldflags` argument. |\n| extra_files | **Optional** | Extra files that will be packaged into artifacts either. Multiple files separated by space. Note that extra folders can be allowed either since internal `cp -r` already in use. \u003cbr\u003eE.g., `extra_files: LICENSE README.md` |\n| md5sum | **Optional** | Publish `.md5` along with artifacts, `TRUE` by default. |\n| sha256sum | **Optional** | Publish `.sha256` along with artifacts, `FALSE` by default. |\n| release_tag | **Optional** | Target release tag to publish your binaries to. It's dedicated to publish binaries on every `push` into one specified release page since there's no target in this case. DON'T set it if you trigger the action by `release: [created]` event as most people do.|\n| release_name           | **Optional**               | Alternative to `release_tag` for release target specification and binary push. The newest release by given `release_name` will be picked from all releases. Useful for e.g. untagged(draft) ones.|\n| release_repo           | **Optional**               | Repository where the build should be pushed to. By default the value for this is the repo from where the action is running. Useful if you use a different repository for your releases (private repo for code, public repo for releases).|\n| overwrite | **Optional** | Overwrite asset if it's already exist. `FALSE` by default. |\n| asset_name | **Optional** | Customize asset name if do not want to use the default format `${BINARY_NAME}-${RELEASE_TAG}-${GOOS}-${GOARCH}`. \u003cbr\u003eMake sure set it correctly, especially for matrix usage that you have to append `-${{ matrix.goos }}-${{ matrix.goarch }}`. A valid example could be  `asset_name: binary-name-${{ matrix.goos }}-${{ matrix.goarch }}`. |\n| retry | **Optional** | How many times retrying if upload fails. `3` by default. |\n| post_command | **Optional** | Extra command that will be executed for teardown work. e.g. you can use it to upload artifacts to AWS s3 or aliyun OSS |\n| compress_assets | **Optional** | `auto` default will produce a `zip` file for Windows and `tar.gz` for others. `zip` will force the use of `zip`. `OFF` will disable packaging of assets. |\n| upload | **Optional** | Upload release assets or not. It'll be useful if you'd like to use subsequent workflow to process the file, such as **signing it on macos**, and so on. |\n\n### Output Parameters\n\n| Parameter | Description |\n| --------- | -------- |\n| release_asset_dir | Release file directory provided for use by other workflows. |\n\n\n### Advanced Example\n\n- Release for multiple OS/ARCH in parallel by matrix strategy.\n- `Go` code is not in `.` of your repository.\n- Customize binary name.\n- Use `go 1.13.1` from downloadable URL instead of the default version.\n- Package extra `LICENSE` and `README.md` into artifacts.\n\n```yaml\n# .github/workflows/release.yaml\n\non:\n  release:\n    types: [created]\n\npermissions:\n    contents: write\n    packages: write\n\njobs:\n  releases-matrix:\n    name: Release Go Binary\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64\n        goos: [linux, windows, darwin]\n        goarch: [\"386\", amd64, arm64]\n        exclude:\n          - goarch: \"386\"\n            goos: darwin\n          - goarch: arm64\n            goos: windows\n    steps:\n    - uses: actions/checkout@v4\n    - uses: wangyoucao577/go-release-action@v1\n      with:\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        goos: ${{ matrix.goos }}\n        goarch: ${{ matrix.goarch }}\n        goversion: \"https://dl.google.com/go/go1.13.1.linux-amd64.tar.gz\"\n        project_path: \"./cmd/test-binary\"\n        binary_name: \"test-binary\"\n        extra_files: LICENSE README.md\n```\n\n### More Examples\nWelcome share your usage for other people's reference!\n- [wiki/More-Examples](https://github.com/wangyoucao577/go-release-action/wiki/More-Examples)\n\n[:clap:](\":clap:\")[:clap:](\":clap:\")[:clap:](\":clap:\") Enjoy! Welcome [star](https://github.com/wangyoucao577/go-release-action/) if like it[:smile:](:smile:)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwangyoucao577%2Fgo-release-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwangyoucao577%2Fgo-release-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwangyoucao577%2Fgo-release-action/lists"}