Skip to content

Commit

Permalink
chore: gzip binaries in Release Action
Browse files Browse the repository at this point in the history
  • Loading branch information
sdnts committed Apr 23, 2024
1 parent f1972ad commit 60dce3b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 45 deletions.
37 changes: 27 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- run: git tag ${{ github.event.inputs.version }}
- run: git push origin ${{ github.event.inputs.version }}
- run: |
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}
- uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.version }}
Expand All @@ -28,48 +29,64 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
- run: zig build -Doptimize=ReleaseSmall -Dtarget=aarch64-macos -Dname=zup-macos-aarch64
- run: |
zig build -Doptimize=ReleaseSmall -Dtarget=aarch64-macos
tar -czf zup-macos-aarch64.tar.gz -C zig-out/bin zup
shasum -a 256 zup-macos-aarch64.tar.gz > zup-macos-aarch64.tar.gz.sha256
- uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.version }}
draft: true
allowUpdates: true
artifacts: "zig-out/bin/zup-macos-aarch64"
artifacts: "zup-macos-aarch64.tar.gz,zup-macos-aarch64.tar.gz.sha256"

macos-x86_64:
needs: tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
- run: zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-macos -Dname=zup-macos-x86_64
- run: |
zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-macos
tar -czf zup-macos-x86_64.tar.gz -C zig-out/bin zup
shasum -a 256 zup-macos-x86_64.tar.gz > zup-macos-x86_64.tar.gz.sha256
- uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.version }}
draft: true
allowUpdates: true
artifacts: "zig-out/bin/zup-macos-x86_64"
artifacts: "zup-macos-x86_64.tar.gz,zup-macos-x86_64.tar.gz.sha256"

linux-aarch64:
needs: tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
- run: zig build -Doptimize=ReleaseSmall -Dtarget=aarch64-linux -Dname=zup-linux-aarch64
- run: |
zig build -Doptimize=ReleaseSmall -Dtarget=aarch64-linux
tar -czf zup-linux-aarch64.tar.gz -C zig-out/bin zup
shasum -a 256 zup-linux-aarch64.tar.gz > zup-linux-aarch64.tar.gz.sha256
- uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.version }}
draft: true
allowUpdates: true
artifacts: "zig-out/bin/zup-linux-aarch64"
artifacts: "zup-linux-aarch64.tar.gz,zup-linux-aarch64.tar.gz.sha256"

linux-x86_64:
needs: tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: goto-bus-stop/setup-zig@v2
- run: zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-linux -Dname=zup-linux-x86_64
- run: |
zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-linux
tar -czf zup-linux-x86_64.tar.gz -C zig-out/bin zup
shasum -a 256 zup-linux-x86_64.tar.gz > zup-linux-x86_64.tar.gz.sha256
- uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.version }}
draft: true
allowUpdates: true
artifacts: "zig-out/bin/zup-linux-x86_64"
artifacts: "zup-linux-x86_64.tar.gz,zup-linux-x86_64.tar.gz.sha256"
55 changes: 23 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,20 @@ expect it to supersede `zup` at some point.

### Installation

#### Package Managers

- [x] Homebrew (macOS): `brew tap sdnts/tools && brew install zup`
- [ ] Linux: TBD

Then, add `~/.zup/bin` to your $PATH (this is where Zup installs toolchains by
default):

```sh
# sh / bash / zsh
export PATH=$PATH:/home/sid/.zup/bin
```

OR

```fish
# fish
fish_add_path /home/sid/.zup/bin
```

#### Prebuilt binaries

Alternatively, you can download a pre-compiled binary for a supported OS / arch
from the [Releases](https://github.com/sdnts/zup/releases) page and place it in
a location that is in your $PATH. I recommend `~/.zup/bin`, since that is also
where Zup installs toolchains by default. You may also want to rename it to `zup`,
and give it execution permissions by running `chmod +x zup`.
You can download a pre-built binary for a supported OS / arch from the
[Releases](https://github.com/sdnts/zup/releases) page, extract, and
place it in a location that is in your $PATH. I recommend `~/.zup/bin`, since
that is also where Zup installs toolchains by default. You may also have to give
it execution permissions by running `chmod +x zup`.

Then, add `~/.zup/bin` to your $PATH:

```sh
# sh / bash / zsh
export PATH=$PATH:/home/sid/.zup/bin
```

```fish
#### OR ####

# fish
fish_add_path /home/sid/.zup/bin
```
Expand All @@ -67,11 +45,9 @@ defaults to `~/.zup`
```sh
# sh / bash / zsh
export ZUP_PREFIX=/usr/local/.zup
```

OR
#### OR ####

```fish
# fish
set -x ZUP_PREFIX /usr/local/.zup
```
Expand Down Expand Up @@ -120,6 +96,21 @@ Display all usage instructions:
$ zup --help
```

### Uninstallation

Uninstallation is a matter of deleting the `zup` binary, as well as all installed
toolchain versions.

Delete the `zup` binary from wherever you put it initially (run `which zup` to
find out).

Installed toolchains are not deleted automatically out of an abundance of caution.
If you overrode the `ZUP_PREFIX` environment variable, delete the directory it
points to, and unset the environment variable. Otherwise, delete the `~/.zup`
directory.

Also don't forget to remove `~/.zup/bin` from your $PATH.

---

### Development
Expand Down
4 changes: 1 addition & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

// Argument to override binary name. Used in "Release" GitHub Action.
const bin_name = b.option([]const u8, "name", "Name of the binary on disk");
const exe = b.addExecutable(.{
.name = bin_name orelse "zup",
.name = "zup",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
Expand Down

0 comments on commit 60dce3b

Please sign in to comment.