Browse Source

feat: x-platform publishing

main
decentral1se 3 years ago
parent
commit
c18c085d28
No known key found for this signature in database GPG Key ID: 3789458B3D0C410
  1. 1
      .gitignore
  2. 58
      .goreleaser.yaml
  3. 21
      Makefile
  4. 108
      README.md
  5. BIN
      distribusi
  6. 16
      distribusi.go

1
.gitignore

@ -1,2 +1,3 @@
*.css
dist/
test

58
.goreleaser.yaml

@ -0,0 +1,58 @@
---
project_name: distribusi
gitea_urls:
api: https://git.vvvvvvaria.org/api/v1
download: https://git.vvvvvvaria.org/
skip_tls_verify: false
before:
hooks:
- go mod tidy
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- 386
- amd64
- arm
- arm64
goarm:
- 5
- 6
- 7
ldflags:
- "-X 'main.Version={{ .Version }}'"
- "-X 'main.Commit={{ .Commit }}'"
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
format: binary
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-alpha"
changelog:
sort: asc
filters:
exclude:
- "^Revert"
- "^docs:"
- "^test:"
- "^tests:"
- "^wip:"

21
Makefile

@ -0,0 +1,21 @@
COMMIT := $(shell git rev-list -1 HEAD)
LDFLAGS := "-X 'main.Commit=$(COMMIT)'"
DIST_LDFLAGS := $(LDFLAGS)" -s -w"
default: build
build:
@go build -ldflags=$(LDFLAGS) .
install:
@go install -ldflags=$(LDFLAGS) .
test:
@go test ./... -cover -v
release:
@goreleaser release --snapshot --rm-dist && \
ssh varia.zone mkdir -p public_html/distribusi-go/$(VERSION) && \
scp -r dist/* varia.zone:public_html/distribusi-go/$(VERSION)
.PHONY: build install test release

108
README.md

@ -27,11 +27,73 @@ If you're migrating from the Python version or have experience using it, here ar
## Install
```
curl https://git.vvvvvvaria.org/decentral1se/distribusi-go/raw/branch/main/distribusi -o distribusi
:champagne: `distribusi-go` has enterprise cross-platform support! :champagne:
If your platform isn't supported, please see [the entire listing]. If you can't
find it, we can probably support it (see `$GOOS`/`$GOARCH` [on go.dev]), please
[open a ticket].
### GNU/Linux
<details><summary>GNU/Linux (amd64)</summary>
<pre>
curl https://vvvvvvaria.org/~decentral1se/distribusi-go/0.1.0-alpha/distribusi_linux_amd64/distribusi -o distribusi
chmod +x distribusi
./distribusi
```
./distribusi -h # check things work
</pre>
</details>
<details><summary>GNU/Linux (386)</summary>
<pre>
curl https://vvvvvvaria.org/~decentral1se/distribusi-go/0.1.0-alpha/distribusi_linux_386/distribusi -o distribusi
chmod +x distribusi
./distribusi -h # check things work
</pre>
</details>
<details><summary>GNU/Linux (arm64)</summary>
<pre>
curl https://vvvvvvaria.org/~decentral1se/distribusi-go/0.1.0-alpha/distribusi_linux_arm64/distribusi -o distribusi
chmod +x distribusi
./distribusi -h # check things work
</pre>
</details>
### Mac OS X
<details><summary>Mac OS X (amd64)</summary>
<pre>
curl https://vvvvvvaria.org/~decentral1se/distribusi-go/0.1.0-alpha/distribusi_darwin_amd64/distribusi -o distribusi
chmod +x distribusi
./distribusi -h # check things work
</pre>
</details>
<details><summary>Mac OS X (arm64)</summary>
<pre>
curl https://vvvvvvaria.org/~decentral1se/distribusi-go/0.1.0-alpha/distribusi_darwin_arm64/distribusi -o distribusi
chmod +x distribusi
./distribusi -h # check things work
</pre>
</details>
### Windows
<details><summary>Windows (386)</summary>
<pre>
curl https://vvvvvvaria.org/~decentral1se/distribusi-go/0.1.0-alpha/distribusi_windows_386/distribusi.exe -o distribusi
chmod +x distribusi
./distribusi -h # check things work
</pre>
</details>
<details><summary>Windows (amd64)</summary>
<pre>
curl https://vvvvvvaria.org/~decentral1se/distribusi-go/0.1.0-alpha/distribusi_windows_amd64/ -o distribusi
chmod +x distribusi
./distribusi -h # check things work
</pre>
</details>
## Quick start
@ -47,7 +109,7 @@ If you want to ignore certain paths, you can use `-i/--ignore`:
./distribusi -p <path> -s -i '*.gif, *.md, mydir'
```
It supports a list of patterns in a comma separated list, wildcards work, more [here].
It supports a list of patterns in a comma separated list, wildcards work, more [on pkg.go.dev].
If you run into issues, run with `-d/--debug` to see what is happening under the hood.
@ -55,18 +117,25 @@ If you run into issues, run with `-d/--debug` to see what is happening under the
## Hacking
You'll need [Go] >= 1.11 installed. Run `go build .` to build a new `./distribusi` executable.
You'll need [Go] >= 1.11 installed. Run `make` to build a new `./distribusi` executable.
If you wanna learn Go, I've got [this book], feel free to take a loan of it :grinning:
[Go]: https://go.dev
[distribusi]: https://git.vvvvvvaria.org/varia/distribusi
[Pillow]: https://pillow.readthedocs.io/en/stable/installation.html#external-libraries
[exiftool]: https://exiftool.org/
[report issues]: https://git.vvvvvvaria.org/decentral1se/distribusi-go/issues/new/choose
[open a ticket]: https://git.vvvvvvaria.org/decentral1se/distribusi-go/issues/new/choose
[here]: https://pkg.go.dev/path/filepath#Match
[this book]: https://www.gopl.io/
## Release
Currently, you have to be `@decentral1se` to do this:
```
VERSION=<version> make release
```
You can build a local-only release by running this:
```
goreleaser release --snapshot --rm-dist
```
Binaries are in `dist/`.
## Acknowledgements
@ -77,3 +146,14 @@ If you wanna learn Go, I've got [this book], feel free to take a loan of it :gri
![](https://www.gnu.org/graphics/gplv3-or-later.png)
[`LICENSE`](./LICENSE)
[Go]: https://go.dev
[Pillow]: https://pillow.readthedocs.io/en/stable/installation.html#external-libraries
[distribusi]: https://git.vvvvvvaria.org/varia/distribusi
[the entire listing]: https://vvvvvvaria.org/~decentral1se/distribusi-go/
[exiftool]: https://exiftool.org/
[on pkg.go.dev]: https://pkg.go.dev/path/filepath#Match
[on go.dev]: https://go.dev/doc/install/source#environment
[open a ticket]: https://git.vvvvvvaria.org/decentral1se/distribusi-go/issues/new/choose
[report issues]: https://git.vvvvvvaria.org/decentral1se/distribusi-go/issues/new/choose
[this book]: https://www.gopl.io/

BIN
distribusi

Binary file not shown.

16
distribusi.go

@ -26,6 +26,12 @@ import (
"github.com/urfave/cli/v2"
)
// Version is the current version of distribusi-go
var Version string
// Commit is the current commit of distribusi-go
var Commit string
// exiftooInstalled tells us if the exiftool binary is installed or not.
var exiftoolInstalled = true
@ -91,9 +97,17 @@ var htmlBody = `
// main is the command-line entrypoint.
func main() {
if Version == "" {
Version = "dev"
}
if Commit == "" {
Commit = " "
}
app := &cli.App{
Name: "distribusi-go",
Version: "0.1.0-alpha",
Version: fmt.Sprintf("%s-%s", Version, Commit[:7]),
Usage: "low-tech content management system for the web",
Description: `
Distribusi is a content management system for the web that produces static

Loading…
Cancel
Save