Skip to content

Small improvements

Small improvements #21

Workflow file for this run

name: Deploy
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: write
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: aarch64-apple-darwin
- build: windows
os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1.75.0 stable
# Arguments to pass in
with:
# Specify the toolchain (required)
toolchain: stable
# Make Rust compile to our target (defined in the matrix)
targets: ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.target }}
- name: Build GUI version
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
with:
use-cross: true
command: build
args: --verbose --release --target ${{ matrix.target }} --features gui
- name: Build archive
shell: bash
run: |
# CLI binary name
binary_name="enc-file"
# GUI binary name
gui_binary_name="enc-file-gui"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
# Copy CLI binary
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
mv "target/${{ matrix.target }}/release/$gui_binary_name.exe" "$dirname"
else
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
mv "target/${{ matrix.target }}/release/$gui_binary_name" "$dirname"
fi
# Add README for the release
cat > "$dirname/README.txt" << EOF
enc_file - Secure File Encryption
=================================
This archive contains both the CLI and GUI versions of enc_file:
• $binary_name (or $binary_name.exe) - Command-line interface
• $gui_binary_name (or $gui_binary_name.exe) - Graphical user interface
For usage instructions, run '$binary_name --help' or launch the GUI.
Visit https://github.com/ArdentEmpiricist/enc_file for documentation.
EOF
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@72f2c25fcb47643c292f7107632f7a47c1df5cd8 # v2.3.2
with:
files: |
${{ env.ASSET }}