Git Product home page Git Product logo

go-release.action's Introduction

Go Release Binary GitHub Action

Automate publishing Go build artifacts for GitHub releases through GitHub Actions.

Detects a build.sh in the go repo and will use that instead. Expects a list of file artifacts in a single, space delimited line as output for packaging.

Extra environment variables:

  • CMD_PATH
    • Pass extra commands to go build
  • EXTRA_FILES
    • Pass a list of extra files for packaging.
      • Example: EXTRA_FILES: "README.md LICENSE"
# .github/workflows/release.yaml

on: release
name: Build Release
jobs:
  release-linux-386:
    name: release linux/386
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: compile and release
      uses: ngs/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GOARCH: "386"
        GOOS: linux
        EXTRA_FILES: "LICENSE"
  release-linux-amd64:
    name: release linux/amd64
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: compile and release
      uses: ngs/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GOARCH: amd64
        GOOS: linux
        EXTRA_FILES: "LICENSE"
  release-linux-arm:
    name: release linux/386
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: compile and release
      uses: ngs/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GOARCH: "arm"
        GOOS: linux
        EXTRA_FILES: "LICENSE"
  release-linux-arm64:
    name: release linux/amd64
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: compile and release
      uses: ngs/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GOARCH: arm64
        GOOS: linux
        EXTRA_FILES: "LICENSE"
  release-darwin-amd64:
    name: release darwin/amd64
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: compile and release
      uses: ngs/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GOARCH: amd64
        GOOS: darwin
        EXTRA_FILES: "LICENSE"
  release-windows-386:
    name: release windows/386
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: compile and release
      uses: ngs/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GOARCH: "386"
        GOOS: windows
        EXTRA_FILES: "LICENSE"
  release-windows-amd64:
    name: release windows/amd64
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: compile and release
      uses: ngs/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        GOARCH: amd64
        GOOS: windows
        EXTRA_FILES: "LICENSE"

go-release.action's People

Contributors

aiziyuer avatar anderslauri avatar ngs avatar usk81 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-release.action's Issues

Always 3 go-release.action workflows for a release

In my repo PatMis16/promalert2bmctsom I trigger the go-release.action whenever a release is created. This works fine but I always see three workflows running for the same release:
github_workflow_runs

Is this a normal behaviour?

compile and release fails with "Could not resolve host: null"

Hello!

I need some help.
I try to automatically create binary releases of my go program. I am getting this error when "compile and release":

`+ curl -X POST --data-binary @tmp.tgz -H 'Content-Type: application/gzip' -H 'Authorization: ***' 'null?name=promalert2bmctsom_null_linux_amd64.tar.gz'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: null`

Couldn't figure out where null is coming from. I guess it want's to upload the binaries but it cant.

Thanks for advice.

Regards,
Patrick

Failure to build the binaries

Hello there,

I am trying to release the binaries in my Github project odfe-kibana-sync but it is failing with no obvious reason - see below a snippet from the pipeline log.

I suspect this is due to this dependency: https://github.com/spf13/cobra. Any idea how to proceed?

Kind regards,

Ayache

`Run ngs/[email protected]
env:
GITHUB_TOKEN: ***
GOARCH: arm64
GOOS: linux
EXTRA_FILES: LICENSE
/usr/bin/docker run --name e492553ed176de4ffd900b3a6f454da009_5bcc2e --label 5588e4 --workdir /github/workspace --rm -e GITHUB_TOKEN -e GOARCH -e GOOS -e EXTRA_FILES -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/odfe-kibana-sync/odfe-kibana-sync":"/github/workspace" 5588e4:92553ed176de4ffd900b3a6f454da009

  • /build.sh
  • PROJECT_ROOT=/go/src/github.com/akhettar/odfe-kibana-sync
  • mkdir -p /go/src/github.com/akhettar/odfe-kibana-sync
  • rmdir /go/src/github.com/akhettar/odfe-kibana-sync
  • ln -s /github/workspace /go/src/github.com/akhettar/odfe-kibana-sync
  • cd /go/src/github.com/akhettar/odfe-kibana-sync
  • go get -v ./...
    go get: warning: modules disabled by GO111MODULE=auto in GOPATH/src;
    ignoring go.mod;
    see 'go help modules'
    github.com/spf13/cobra (download)
    github.com/spf13/pflag (download)
    errors
    internal/cpu
    internal/race
    runtime/internal/atomic
    internal/bytealg
    runtime/internal/sys
    sync/atomic
    runtime
    unicode
    unicode/utf8
    encoding
    math
    math/bits
    strconv
    internal/testlog
    unicode/utf16
    container/list
    crypto/internal/subtle
    crypto/subtle
    crypto/rc4
    vendor/golang_org/x/crypto/cryptobyte/asn1
    vendor/golang_org/x/net/dns/dnsmessage
    internal/nettrace
    github.com/akhettar/odfe-kibana-sync/model
    sync
    io
    reflect
    bytes
    syscall
    time
    encoding/binary
    encoding/base64
    internal/syscall/unix
    sort
    internal/poll
    strings
    os
    hash
    crypto
    crypto/cipher
    fmt
    crypto/aes
    crypto/des
    encoding/json
    math/rand
    math/big
    crypto/internal/randutil
    crypto/sha512
    crypto/hmac
    crypto/md5
    bufio
    crypto/sha1
    crypto/elliptic
    encoding/asn1
    crypto/rand
    crypto/ecdsa
    crypto/rsa
    crypto/sha256
    crypto/dsa
    encoding/hex
    encoding/pem
    crypto/x509/pkix
    vendor/golang_org/x/crypto/cryptobyte
    path/filepath
    io/ioutil
    context
    internal/singleflight
    net/url
    net
    vendor/golang_org/x/crypto/internal/chacha20
    vendor/golang_org/x/crypto/poly1305
    vendor/golang_org/x/crypto/chacha20poly1305
    vendor/golang_org/x/crypto/curve25519
    compress/flate
    hash/crc32
    compress/gzip
    vendor/golang_org/x/text/transform
    log
    vendor/golang_org/x/text/unicode/bidi
    vendor/golang_org/x/text/secure/bidirule
    vendor/golang_org/x/text/unicode/norm
    crypto/x509
    vendor/golang_org/x/net/idna
    crypto/tls
    net/textproto
    vendor/golang_org/x/net/http/httpguts
    vendor/golang_org/x/net/http/httpproxy
    vendor/golang_org/x/net/http2/hpack
    mime
    mime/quotedprintable
    mime/multipart
    net/http/httptrace
    net/http/internal
    path
    encoding/csv
    net/http
    flag
    github.com/spf13/pflag
    text/template/parse
    text/template
    github.com/spf13/cobra

github.com/spf13/cobra

../../spf13/cobra/bash_completions.go:22:24: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:383:26: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:423:24: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:435:27: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:473:25: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:484:20: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:499:38: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:525:21: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:562:28: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:587:29: undefined: io.StringWriter
../../spf13/cobra/bash_completions.go:587:29: too many errors
github.com/akhettar/odfe-kibana-sync/client
`

UPLOAD_MODE "release" was specified but no URL to upload to could be detected

name: Release
on:
  push:
    tags:
      - "v*"

permissions:
  contents: write

jobs:
  release:
    name: release ${{ matrix.target }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-pc-windows-gnu
            archive: zip
          - target: x86_64-unknown-linux-musl
            archive: tar.gz tar.xz tar.zst
          - target: x86_64-apple-darwin
            archive: zip
    steps:
      - uses: actions/checkout@master
      - name: Compile and release
        uses: rust-build/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          RUSTTARGET: ${{ matrix.target }}
          ARCHIVE_TYPES: ${{ matrix.archive }}

image

Add path to custom main.go

Add ENV variable CMD_PATH

example:

CMD_PATH = "cmd/hcfc/main.go"

to build.sh

- go build
+ go build $CMD_PATH

Explain explicitly what is being packaged with this action

It is not quite clear to me what artifacts are being packaged by this action by default. I see that I can use EXTRA_FILES to request additional files, but I can't see what files are being packaged by default.

Sure I can do a quick experiment and figure it out on my own, but it would be nice and helpful if the documentation spelled it out.

Naming archive and binary name separately

I just tested your GitHub action for my company project with Go. I named my binary_name like: "<project_name>_<$release_version>" that give this -> test-ci_v0.48.
But the package is named like this -> test-ci_v0.48-v0.48-darwin-amd64.tar.gz. You see the unwanted result ?

So my question is: is it possible in the project or in the configuration file to set specific name for package name ? And if so, can you add the possibility the set it please.

Best regards

(PS: sorry i'm french, i do my best in english)

musl is required to run 64 bits binaries

I just tried to used this action on one of my project but I can't run the generated Linux AMD64 version on my Linux AMD64 machine.

It seems to be related to the dynamic linking to the musl C standard library:

./my-generated-exe-amd64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, Go BuildID=EmDsSWNEfmQPkFFReAgq/dJXhA5cdfTA7Hjt5NAr_/x6hwGePSXNBHuxESCok8/OgK2kl0KXGeheYHuSau3, not stripped

ldd ./my-generated-exe-amd64
	linux-vdso.so.1 (0x00007ffc7b327000)
	libc.musl-x86_64.so.1 => not found

However, the i386 version works fine and is statically linked:

file ./docker-manager
./my-generated-exe-i386: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, Go BuildID=y1r_iZoir6tGXmSRok8q/YdxAzTSJRZV17bSFn5r4/AtCijuMBQ5R07GgeAe1b/xsie6X5UnPs1fnjuhsv8, not stripped

ldd ./my-generated-exe-i386
	not a dynamic executable

Could this be solved by statically link the AMD64 version also? Or maybe switch to libc which is more commonly available?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.