-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
75 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,120 +1,81 @@ | ||
name: CD | ||
name: Deploy | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
push: | ||
tags: | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
|
||
macos: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build the executable | ||
run: cargo build --release | ||
|
||
- uses: Shopify/upload-to-release@v2.0.0 | ||
with: | ||
name: target/release/textpod | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
windows: | ||
runs-on: windows-2019 | ||
steps: | ||
- run: git config --global core.autocrlf false | ||
|
||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build the executable | ||
run: cargo build --release | ||
|
||
- uses: Shopify/upload-to-release@v2.0.0 | ||
with: | ||
name: textpod.exe | ||
path: target\release\textpod.exe | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
gnu_linux_armhf: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Prepare cross-platform environment | ||
run: | | ||
sudo mkdir /cross-build | ||
sudo touch /etc/apt/sources.list.d/armhf.list | ||
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ focal main" | sudo tee -a /etc/apt/sources.list.d/armhf.list | ||
sudo apt-get update | ||
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross | ||
sudo apt-get download libssl1.1:armhf libssl-dev:armhf | ||
sudo dpkg -x libssl1.1*.deb /cross-build | ||
sudo dpkg -x libssl-dev*.deb /cross-build | ||
rustup target add arm-unknown-linux-gnueabihf | ||
echo "C_INCLUDE_PATH=/cross-build/usr/include" >> $GITHUB_ENV | ||
echo "OPENSSL_INCLUDE_DIR=/cross-build/usr/include/arm-linux-gnueabihf" >> $GITHUB_ENV | ||
echo "OPENSSL_LIB_DIR=/cross-build/usr/lib/arm-linux-gnueabihf" >> $GITHUB_ENV | ||
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV | ||
echo "RUSTFLAGS=-C linker=arm-linux-gnueabihf-gcc -L/usr/arm-linux-gnueabihf/lib -L/cross-build/usr/lib/arm-linux-gnueabihf -L/cross-build/lib/arm-linux-gnueabihf" >> $GITHUB_ENV | ||
- name: Build the executable | ||
run: cargo build --release --target=arm-unknown-linux-gnueabihf | ||
|
||
- name: Attach artifact to the release | ||
uses: Shopify/upload-to-release@v2.0.0 | ||
with: | ||
name: textpod-gnu-linux-armhf | ||
path: target/arm-unknown-linux-gnueabihf/release/textpod | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
gnu_linux_aarch64: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
permissions: | ||
contents: write | ||
|
||
- name: Prepare cross-platform environment | ||
run: | | ||
sudo mkdir /cross-build | ||
sudo touch /etc/apt/sources.list.d/arm64.list | ||
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main" | sudo tee -a /etc/apt/sources.list.d/arm64.list | ||
sudo apt-get update | ||
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross | ||
sudo apt-get download libssl1.1:arm64 libssl-dev:arm64 | ||
sudo dpkg -x libssl1.1*.deb /cross-build | ||
sudo dpkg -x libssl-dev*.deb /cross-build | ||
rustup target add aarch64-unknown-linux-gnu | ||
echo "C_INCLUDE_PATH=/cross-build/usr/include" >> $GITHUB_ENV | ||
echo "OPENSSL_INCLUDE_DIR=/cross-build/usr/include/aarch64-linux-gnu" >> $GITHUB_ENV | ||
echo "OPENSSL_LIB_DIR=/cross-build/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV | ||
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV | ||
echo "RUSTFLAGS=-C linker=aarch64-linux-gnu-gcc -L/usr/aarch64-linux-gnu/lib -L/cross-build/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV | ||
- name: Build the executable | ||
run: cargo build --release --target=aarch64-unknown-linux-gnu | ||
|
||
- name: Attach artifact to the release | ||
uses: Shopify/upload-to-release@v2.0.0 | ||
with: | ||
name: textpod-gnu-linux-aarch64 | ||
path: target/aarch64-unknown-linux-gnu/release/textpod | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
jobs: | ||
build-and-upload: | ||
name: Build and upload | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
# You can add more, for any target you'd like! | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
|
||
- build: macos | ||
os: macos-latest | ||
target: x86_64-apple-darwin | ||
|
||
- build: windows-gnu | ||
os: windows-latest | ||
target: x86_64-pc-windows-gnu | ||
|
||
gnu_linux_x86_64: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build the executable | ||
run: cargo build --release | ||
|
||
- uses: Shopify/upload-to-release@v2.0.0 | ||
with: | ||
name: textpod-gnu-linux-x86_64 | ||
path: target/release/textpod | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get the release version from the tag | ||
shell: bash | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Install Rust | ||
# Or @nightly if you want | ||
uses: dtolnay/rust-toolchain@stable | ||
# Arguments to pass in | ||
with: | ||
# Make Rust compile to our target (defined in the matrix) | ||
targets: ${{ matrix.target }} | ||
|
||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: build | ||
args: --verbose --release --target ${{ matrix.target }} | ||
|
||
- name: Build archive | ||
shell: bash | ||
run: | | ||
# Replace with the name of your binary | ||
binary_name="textpod" | ||
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" | ||
mkdir "$dirname" | ||
if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" | ||
else | ||
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" | ||
fi | ||
if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
7z a "$dirname.zip" "$dirname" | ||
echo "ASSET=$dirname.zip" >> $GITHUB_ENV | ||
else | ||
tar -czf "$dirname.tar.gz" "$dirname" | ||
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | ||
fi | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
${{ env.ASSET }} |