Skip to content

Commit

Permalink
workflows + rename to asciigen
Browse files Browse the repository at this point in the history
  • Loading branch information
seatedro committed Aug 27, 2024
1 parent 5aa9f56 commit 6d3e80e
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 4 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Release

on:
push:
tags:
- 'v*'

jobs:
build:
name: Build for all targets
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-linux, aarch64-linux, x86_64-macos, aarch64-macos]

steps:
- uses: actions/checkout@v3

- name: Set up Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0

- name: Build
run: |
zig build -Dtarget=${{ matrix.target }} -Drelease
mkdir -p dist
mv zig-out/bin/asciigen dist/asciigen-${{ matrix.target }}
cd dist && tar czf asciigen-${{ matrix.target }}.tar.gz asciigen-${{ matrix.target }}
- name: Generate SHA256
run: |
cd dist
sha256sum asciigen-${{ matrix.target }}.tar.gz > asciigen-${{ matrix.target }}.tar.gz.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: asciigen-${{ matrix.target }}
path: dist/asciigen-${{ matrix.target }}.tar.gz*

release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3

- name: Prepare release assets
run: |
mkdir release_assets
mv asciigen-*/*.tar.gz* release_assets/
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
release_assets/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ fn runZig(
optimize: std.builtin.OptimizeMode,
) !void {
const exe = b.addExecutable(.{
.name = "img2ascii",
.name = "asciigen",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});

const exe_check = b.addExecutable(.{
.name = "img2ascii-check",
.name = "asciigen-check",
.root_source_file = b.path("src/check.zig"),
.target = target,
.optimize = optimize,
Expand Down
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.{
.name = "img2ascii",
.name = "asciigen",
// This is a [Semantic Version](https://semver.org/).
// In a future version of Zig it will be used for package deduplication.
.version = "0.0.0",
.version = "1.0.0",

// This field is optional.
// This is currently advisory only; Zig does not yet do anything
Expand Down
13 changes: 13 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ converts an image to ascii art

## usage

### pre-built binaries

you can download the latest release from github: [here](https://github.com/seatedro/asciigen/releases/latest)

you can also install it with homebrew:

```bash
brew tap seatedro/asciigen
brew install asciigen
```

### build from source

`zig build -Drelease run -- -i path/to/input.jpeg -o path/to/output.png`

output file needs to be a `.png` since i saw some weird issues with jpegs.
Expand Down

0 comments on commit 6d3e80e

Please sign in to comment.