Skip to content

Commit

Permalink
Merge pull request #9 from StevenMaude/build-windows
Browse files Browse the repository at this point in the history
Build Windows binary
  • Loading branch information
StevenMaude authored Jul 26, 2020
2 parents 6db2080 + f8bcf27 commit 0299d08
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:

- name: Build code
run: |
make build
make build-linux
- name: Run code
run: |
./armstrong
./armstrong_linux_amd64
21 changes: 16 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Compiled binary
/armstrong
# Compiled binaries
/armstrong_linux_amd64
/armstrong.exe

# Output files
/EPO.BIN
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0299d08

Please sign in to comment.