Skip to content

Commit 494703a

Browse files
use matrix strategy for cross-platform builds (#7)
* use matrix strategy for cross-platform builds * add inform about using binary in dockerfile * add arm64 windows build * return test job --------- Co-authored-by: Fedor Batonogov <f.batonogov@yandex.ru>
1 parent 68b9fed commit 494703a

File tree

2 files changed

+57
-5
lines changed

2 files changed

+57
-5
lines changed

.github/workflows/go.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ jobs:
1818
contents: write
1919
packages: write
2020

21+
strategy:
22+
matrix:
23+
include:
24+
- os: linux
25+
arch: amd64
26+
- os: linux
27+
arch: arm64
28+
- os: darwin
29+
arch: amd64
30+
- os: darwin
31+
arch: arm64
32+
- os: windows
33+
arch: amd64
34+
suffix: .exe
35+
- os: windows
36+
arch: arm64
37+
suffix: .exe
38+
2139
steps:
2240
- uses: actions/checkout@v4
2341

@@ -27,14 +45,21 @@ jobs:
2745
go-version: "1.23.3"
2846

2947
- name: Build
30-
run: go build -v ./...
48+
run: |
49+
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o gron-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix || '' }}
3150
3251
- name: Test
3352
run: go test -v ./...
3453

54+
- name: Upload artifact
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: gron-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix || '' }}
58+
path: gron-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix || '' }}
59+
3560
- name: Release
36-
uses: softprops/action-gh-release@v1
61+
uses: softprops/action-gh-release@v2.1.0
3762
if: startsWith(github.ref, 'refs/tags/')
3863
with:
39-
files: gron
40-
generate_release_notes: true
64+
files: gron-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix || '' }}
65+
generate_release_notes: false

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A simple and flexible task scheduler in a Docker container that supports both st
1111

1212
## Usage
1313

14-
### Basic Example
14+
### Using Docker Image
1515

1616
```bash
1717
docker run --rm \
@@ -22,6 +22,33 @@ docker run --rm \
2222
ghcr.io/batonogov/gron:v0.1.1
2323
```
2424

25+
### Using Binary in Your Dockerfile
26+
27+
You can download and use pre-built binaries in your own Docker images. Binaries are available for multiple platforms:
28+
29+
- Linux (amd64, arm64)
30+
- macOS (Intel, Apple Silicon)
31+
- Windows (amd64, arm64)
32+
33+
Example Dockerfile:
34+
35+
```dockerfile
36+
FROM alpine:latest
37+
38+
# Download gron binary for linux/amd64
39+
ADD https://github.com/batonogov/gron/releases/download/v0.1.1/gron-linux-amd64 /usr/local/bin/gron
40+
41+
# Make it executable
42+
RUN chmod +x /usr/local/bin/gron
43+
44+
# Your configuration
45+
COPY ./scripts /scripts
46+
ENV TASK_1="*/5 * * * * /scripts/backup.sh"
47+
48+
# Run gron
49+
CMD ["/usr/local/bin/gron"]
50+
```
51+
2552
### Command Structure
2653

2754
```bash

0 commit comments

Comments
 (0)