diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a28958f..c28f873 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,8 +16,8 @@ jobs: - name: Build code run: | - make build + make build-linux - name: Run code run: | - ./armstrong + ./armstrong_linux_amd64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fba7b42..9c49539 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,17 +13,17 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Build code + - name: Build Linux binary run: | - make build + make build-linux - - name: Rename binary + - name: Build Windows binary run: | - mv ./armstrong ./armstrong_linux_amd64 + make build-windows - name: Calculate SHA256 run: | - sha256sum ./armstrong_linux_amd64 > SHA256SUMS + sha256sum armstrong_linux_amd64 armstrong.exe > SHA256SUMS - name: Create Release id: create_release @@ -47,6 +47,17 @@ jobs: asset_name: armstrong_linux_amd64 asset_content_type: application/octet-stream + - name: Upload Windows binary to GitHub + id: upload-windows-binary + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./armstrong.exe + asset_name: armstrong.exe + asset_content_type: application/octet-stream + - name: Upload SHA256SUMS to GitHub id: upload-sha256sums uses: actions/upload-release-asset@v1 diff --git a/.gitignore b/.gitignore index f75c6ed..f320881 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -# Compiled binary -/armstrong +# Compiled binaries +/armstrong_linux_amd64 +/armstrong.exe # Output files /EPO.BIN diff --git a/Dockerfile b/Dockerfile index c6abe47..2345a66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM golang:1.14-alpine USER nobody:nogroup +ARG GOOS + ENV CGO_ENABLED=0 XDG_CACHE_HOME=/tmp/.cache WORKDIR /go/src/armstrong diff --git a/Makefile b/Makefile index 8c67150..68bbd26 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ -build: +build-linux: docker build . -t armstrong - docker run --rm --entrypoint cat armstrong /go/bin/armstrong > armstrong - chmod u+x armstrong + docker run --rm --entrypoint cat armstrong /go/bin/armstrong > armstrong_linux_amd64 + chmod u+x armstrong_linux_amd64 -.PHONY: build +build-windows: + docker build --build-arg GOOS=windows . -t armstrong + docker run --rm --entrypoint cat armstrong /go/bin/windows_amd64/armstrong.exe > armstrong.exe + +.PHONY: build-linux build-windows diff --git a/README.md b/README.md index 2902a5d..a4d2f1b 100644 --- a/README.md +++ b/README.md @@ -28,23 +28,24 @@ without any dependencies. ### Download -If you don't want to build from source, [Linux -releases](https://github.com/StevenMaude/armstrong/releases) are built +If you don't want to build from source, [Linux and Windows +binaries](https://github.com/StevenMaude/armstrong/releases) are built from tagged versions via GitHub Actions. ### Build With Go installed: -* `go build armstrong.go` +* `go build` or `go install` Or, use the `Dockerfile` via `make`: -* `make build` +* `make build-linux` (for a Linux build) +* `make build-windows` (for a Windows build) ### Run -Just run the compiled `armstrong` binary. `EPO.BIN` should be generated +Just run the compiled binary. `EPO.BIN` should be generated in the same directory. ## Credits