Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Setup Go
uses: actions/setup-go@v5
with:
bun-version: latest

- name: Install dependencies
run: bun install --frozen-lockfile
go-version-file: go.mod

- name: Build binaries
run: bun run build:bin:all
run: make build-bin-all

- name: Make binaries executable
run: |
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test

on:
pull_request:
push:
branches:
- main
- master

permissions:
contents: read

jobs:
test:
name: Unit and E2E Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run tests
run: make test
1 change: 0 additions & 1 deletion .husky/pre-commit

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

675 changes: 9 additions & 666 deletions LICENSE

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
APP := netiploy
BUILD_DIR := build
LDFLAGS := -s -w
GO ?= go
GO_ENV := GOCACHE=$(CURDIR)/.cache/go-build GOMODCACHE=$(CURDIR)/.cache/go-mod

.PHONY: all clean test test-unit test-e2e build build-bin-all \
build-bin-linux-x64 build-bin-linux-arm64 \
build-bin-mac-x64 build-bin-mac-arm64 \
build-bin-win-x64 build-bin-win-arm64 checksums

all: build-bin-all

clean:
rm -rf $(BUILD_DIR)

test: test-unit test-e2e

test-unit:
$(GO_ENV) $(GO) test ./...

test-e2e:
@set -e; \
docker compose up -d; \
trap 'docker compose down' EXIT; \
NETIPLOY_E2E=1 $(GO_ENV) $(GO) test -count=1 -tags=e2e ./internal/netiploy

build:
mkdir -p $(BUILD_DIR)
$(GO_ENV) $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(APP) ./cmd/netiploy

build-bin-all: clean build-bin-linux-x64 build-bin-linux-arm64 build-bin-mac-x64 build-bin-mac-arm64 build-bin-win-x64 build-bin-win-arm64

build-bin-linux-x64:
mkdir -p $(BUILD_DIR)
$(GO_ENV) GOOS=linux GOARCH=amd64 CGO_ENABLED=0 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(APP)-linux-x64 ./cmd/netiploy

build-bin-linux-arm64:
mkdir -p $(BUILD_DIR)
$(GO_ENV) GOOS=linux GOARCH=arm64 CGO_ENABLED=0 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(APP)-linux-arm64 ./cmd/netiploy

build-bin-mac-x64:
mkdir -p $(BUILD_DIR)
$(GO_ENV) GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(APP)-macos-x64 ./cmd/netiploy

build-bin-mac-arm64:
mkdir -p $(BUILD_DIR)
$(GO_ENV) GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(APP)-macos-arm64 ./cmd/netiploy

build-bin-win-x64:
mkdir -p $(BUILD_DIR)
$(GO_ENV) GOOS=windows GOARCH=amd64 CGO_ENABLED=0 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(APP)-win-x64.exe ./cmd/netiploy

build-bin-win-arm64:
mkdir -p $(BUILD_DIR)
$(GO_ENV) GOOS=windows GOARCH=arm64 CGO_ENABLED=0 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(APP)-win-arm64.exe ./cmd/netiploy

checksums: build-bin-all
cd $(BUILD_DIR) && sha256sum \
$(APP)-linux-x64 \
$(APP)-linux-arm64 \
$(APP)-macos-x64 \
$(APP)-macos-arm64 \
$(APP)-win-x64.exe \
$(APP)-win-arm64.exe \
> checksums.txt
64 changes: 31 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
# Netiploy

**Netiploy** is an open-source Bun-optimized CLI tool for deploying static files to Cloudflare R2 (or any S3-compatible storage) without paying for Netlify.
**Netiploy** is an open-source Go CLI tool for deploying static files to Cloudflare R2 (or any S3-compatible storage) without paying for Netlify.

## Installation

```bash
bun install

# Run directly with Bun (no global install required)
bun run src/cli.ts deploy ...

# Or link globally during local development
bun run build
bun link
netiploy deploy ...
make build
./build/netiploy deploy ...
```

## Setup
Expand Down Expand Up @@ -50,7 +43,7 @@ Netiploy detects the endpoint automatically based on the given provider. So, if

```bash
# r2 → cloudflare R2.
# for this to work, you still need `R2_ACCOUNT_ID` env var or `--access-token` argument to be present.
# for this to work, you still need `R2_ACCOUNT_ID` env var or `--account-id` argument to be present.
https://<account_id>.r2.cloudflarestorage.com` (region: `auto`)
```

Expand Down Expand Up @@ -230,44 +223,49 @@ before forwarding the request to R2, which makes SPAs work correctly.
## How to Test

```bash
# Run E2E tests (requires Docker)
docker compose up -d # start localstack
bun test tests/e2e.test.ts # run E2E suite
docker compose down # stop localstack
make test-unit
```

## How to Publish

**NOTE:** Make sure to bump the `version` field in `package.json` and the `VERSION` constant in `src/index.ts`.

### GitHub Releases

1. Run the build command for outputting binaries.
Run the LocalStack-backed E2E deploy tests:

```
bun run build:bin:all
```bash
make test-e2e
```

2. Upload to GitHub Releases with the approriate tag.
Run the complete test suite:

### GitHub Packages
```bash
make test
```

1. For CLI-tool build.
## How to Build

```bash
NPM_CONFIG_TOKEN=<your_github_token> bun run release:gh
# Current platform
make build

# Linux, macOS, and Windows binaries matching the old build:bin:all output names
make build-bin-all
```

2. For library build.
## How to Publish

**NOTE:** Make sure to bump the `version` field in `package.json` and the
default `version` variable in `cmd/netiploy/main.go`.

### GitHub Releases

1. Run the build command for outputting binaries.

```bash
bun run build:lib
# publish manually (possibly full support in the future)
```
make build-bin-all
```

2. Upload to GitHub Releases with the approriate tag.

## Acknowledgements

The XXH32 implementation bundled in `src/xxh32.ts` is adapted from
The XXH32 implementation bundled in `internal/netiploy/xxh32.go` is adapted from
[cgiosy/xxh32](https://github.com/cgiosy/xxh32): a fast, zero-dependency
JavaScript implementation of the XXH32 hash algorithm by Yushin Cho (cgiosy).
Full credit and thanks to the original author.
Loading
Loading