Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/standalone binary #45

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/binaries.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build binaries and Release

on:
push:
branches:
- main
tags:
- "v*"

jobs:
build-and-release:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Cache Python Dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Install Dependencies and Tools
run: |
pip install --upgrade pip
pip install pyinstaller
pip install -r <(python -c '
import toml
with open("pyproject.toml", "r") as f:
project = toml.load(f)["project"]
dependencies = project.get("dependencies", [])
print("\\n".join(dependencies))
')

- name: Build binary
run: pyinstaller --onefile --name envcloak --distpath binaries envcloak/cli.py

- name: Rename Binaries
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
mv binaries/envcloak binaries/envcloak-linux
elif [[ "$RUNNER_OS" == "macOS" ]]; then
mv binaries/envcloak binaries/envcloak-macos
elif [[ "$RUNNER_OS" == "Windows" ]]; then
mv binaries/envcloak binaries/envcloak-windows.exe
fi

- name: Upload binaries to release
uses: softprops/action-gh-release@v1
with:
files: |
binaries/envcloak-linux
binaries/envcloak-macos
binaries/envcloak-windows.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ or if you want `dev` tools too 😎:
pip install envcloak[dev]
```

> 👋 There are also [self-contained binaries](examples/cli/README.MD#get-yourself-a-envcloak-without-requirement-to-use-python-) for `Windows`, `Linux` and `MacOS`, don't have to use python at all! 🥳

## 🚀 Example Workflow

> ℹ️ More examples are present in [examples](./examples) section.
Expand Down
15 changes: 15 additions & 0 deletions examples/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,18 @@ Distribute the `.env.enc` file and keep the `myproject.key` secure.
* Never commit keys: Always use `.gitignore` to exclude `key` files.
* Secure `password`s and `salt`s: Treat them as sensitive as the `key`s themselves.
* Automate `encryption`/`decryption`: Include EnvCloak commands in CI/CD pipelines or scripts for consistency.



## Get yourself a EnvCloak without requirement to use Python! 🥳
Download self-contained binary:
```bash
# For Linux
wget -O envcloak https://github.com/Veinar/envcloak/releases/latest/download/envcloak-linux

# For macOS
wget -O envcloak https://github.com/Veinar/envcloak/releases/latest/download/envcloak-macos

# For Windows
wget -O envcloak.exe https://github.com/Veinar/envcloak/releases/latest/download/envcloak-windows.exe
```
Loading