Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from Hermitter/binaries
Browse files Browse the repository at this point in the history
Add CI for creating binaries
  • Loading branch information
Carlos Chacin authored Mar 14, 2021
2 parents f86ed69 + 2c60f57 commit 51e5b72
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 59 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Build/Upload Binaries
on:
push:
tags:
- v0.*

jobs:
default:
name: ${{ matrix.platforms.target }}
runs-on: ${{ matrix.platforms.os }}
env:
bin_path: "./target/${{ matrix.platforms.target }}/release/tepe${{ matrix.platforms.bin_ext }}"
new_bin_path: "./tepe-${{ matrix.platforms.target }}${{ matrix.platforms.bin_ext }}"
strategy:
matrix:
platforms:
- {
os: "windows-latest",
target: "x86_64-pc-windows-msvc",
cross: false,
bin_ext: ".exe",
}
- {
os: "macOS-latest",
target: "x86_64-apple-darwin",
cross: false,
bin_ext: "",
}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platforms.target }}
override: true

- uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.platforms.cross }}
command: build
args: --release --target=${{ matrix.platforms.target }}

- name: Rename/Move Binary
run: mv ${{ env.bin_path }} ${{ env.new_bin_path }}

- name: Upload Binary
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.platforms.target }}
path: ${{ env.new_bin_path }}
if-no-files-found: error

x86_64-unknown-linux-musl:
# This build targets x86_64-unknown-linux-musl to create a static binary.
# Learn more: https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/musl-support-for-fully-static-binaries.html#musl-support-for-fully-static-binaries
name: x86_64-unknown-linux-musl
runs-on: ubuntu-latest
container: { image: "rust:alpine3.13" }
steps:
- name: Add Alpine Packages
run: apk add openssl-dev musl-dev perl make --no-cache

- name: Download Repository
uses: actions/checkout@v2

- name: Build Binary
run: cargo build --release --features vendored-openssl

- name: Rename/Move Binary
run: mv ./target/release/tepe ./tepe-x86_64-unknown-linux-musl

- name: Reduce Binary Size
run: strip -s ./tepe-x86_64-unknown-linux-musl

- name: Upload Binary
uses: actions/upload-artifact@v2
with:
name: x86_64-unknown-linux-musl
path: ./tepe-x86_64-unknown-linux-musl
if-no-files-found: error

publish:
name: Github Release
needs: [default, x86_64-unknown-linux-musl]
runs-on: ubuntu-latest
steps:
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

# Each file is stored under: ./artifact_name/file_name
- name: Download Binaries
uses: actions/download-artifact@v2

- name: Upload
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./*/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/cargo-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Cargo Publish
on:
push:
tags:
- v0.*

jobs:
build:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Publish Crate
run: cargo publish --token ${{ secrets.CRATES_IO_API_KEY }}
51 changes: 0 additions & 51 deletions .github/workflows/deploy.yml

This file was deleted.

11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ repository = "https://github.com/Hermitter/tepe"
license = "MIT"
description = "A CLI to command a bot to send messages and files over Telegram."

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
teloxide = "0.3.4"
tokio = { version = "0.2.11", features = ["rt-threaded", "macros"] }
clap = {version = "2.33.1", features = ["yaml"]}
lazy_static = "1.4.0"

# Statically link openssl for binaries
openssl = { version = '0.10', features = ["vendored"], optional = true }

[features]
vendored-openssl = ["openssl"]
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,32 @@ Wondering if your build finished? Tepe is a CLI that lets you command a bot to s
# Installation

## 1. Download Tepe
> Installing from source or Crates.io requires [Rust](http://rustup.rs/) on your computer.
> Installing from source/crates.io requires [Rust](http://rustup.rs/) on your computer.
> Linux users will also need to have openssl dev files installed.
> ```
> - Debian: sudo apt install libssl-dev
> - Fedora: sudo dnf install openssl-devel
> - Alpine: sudo apk add openssl-dev
>```
Install Tepe from one of the following:
- [Release Page](https://github.com/Hermitter/tepe/releases/latest)
- [Prebuilt Releases](https://github.com/Hermitter/tepe/releases)
```bash
# linux-amd64 is the only precompiled release for now
curl -L https://github.com/Hermitter/tepe/releases/latest/download/tepe-linux-amd64 -o tepe
# Currently built for x86_64 Linux, Windows, and macOS.
# linux x86_64 setup example
curl -L https://github.com/Hermitter/tepe/releases/latest/download/tepe-x86_64-unknown-linux-musl -o tepe
chmod +x ./tepe
```
- [Crates.io](https://crates.io/crates/tepe):
- **[Crates.io](https://crates.io/crates/tepe)**


```bash
cargo install tepe
```

- Source:
- Source

```bash
git clone https://github.com/Hermitter/tepe && cd tepe
Expand Down

0 comments on commit 51e5b72

Please # to comment.