-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite in rust to have 4x more compact binary
- Loading branch information
1 parent
1d5c359
commit 09bd0bd
Showing
8 changed files
with
468 additions
and
128 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 |
---|---|---|
|
@@ -3,84 +3,71 @@ name: Build and Publish Binary | |
on: | ||
push: | ||
branches: | ||
- master | ||
#- master | ||
- rewrite_in_rust | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
cache: 'pip' | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt pyinstaller | ||
# Setup Rust toolchain; automatically matches the @rev of the action | ||
- uses: dtolnay/rust-toolchain@stable | ||
|
||
- name: Build binary with PyInstaller | ||
run: | | ||
pyinstaller --onefile --clean src/genpeerid.py | ||
# Build the release binary | ||
- name: Build Release Binary | ||
run: cargo build --release | ||
|
||
# Generate SHA512 hash for the binary | ||
- name: Generate SHA512 hash | ||
run: | | ||
cd dist | ||
sha512sum genpeerid > genpeerid.sha512 | ||
(cd target/release && sha512sum genpeerid > genpeerid.sha512) | ||
# Import GPG Key | ||
- name: Import GPG Key | ||
run: | | ||
echo "${{ secrets.HQ_ROTKO_PGP }}" | gpg --batch --import | ||
env: | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
run: echo "${{ secrets.HQ_ROTKO_PGP }}" | gpg --batch --import | ||
|
||
# Configure GPG | ||
- name: Configure GPG | ||
run: | | ||
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf | ||
gpg-connect-agent reloadagent /bye | ||
# Sign binary and hash | ||
- name: Sign binary and hash | ||
run: | | ||
gpg --batch --yes --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --detach-sign --armor --default-key [email protected] --output dist/genpeerid.sig dist/genpeerid | ||
gpg --batch --yes --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --detach-sign --armor --default-key [email protected] --output dist/genpeerid.sha512.sig dist/genpeerid.sha512 | ||
gpg --batch --yes --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --detach-sign --armor --default-key [email protected] --output target/release/genpeerid.sig target/release/genpeerid | ||
gpg --batch --yes --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --detach-sign --armor --default-key [email protected] --output target/release/genpeerid.sha512.sig target/release/genpeerid.sha512 | ||
# Upload artifacts | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: genpeerid-and-signatures | ||
path: | | ||
dist/genpeerid | ||
dist/genpeerid.sig | ||
dist/genpeerid.sha512 | ||
dist/genpeerid.sha512.sig | ||
target/release/genpeerid | ||
target/release/genpeerid.sig | ||
target/release/genpeerid.sha512 | ||
target/release/genpeerid.sha512.sig | ||
# Bump version and tag | ||
- name: Bump version and tag | ||
id: bump_version | ||
uses: anothrNick/github-tag-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | ||
WITH_V: false | ||
uses: anothrNick/[email protected] | ||
with: | ||
github_token: ${{ secrets.GH_PAT }} | ||
|
||
# Create GitHub Release | ||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | ||
with: | ||
files: | | ||
dist/genpeerid | ||
dist/genpeerid.sig | ||
dist/genpeerid.sha512 | ||
dist/genpeerid.sha512.sig | ||
target/release/genpeerid | ||
target/release/genpeerid.sig | ||
target/release/genpeerid.sha512 | ||
target/release/genpeerid.sha512.sig | ||
tag_name: ${{ steps.bump_version.outputs.new_tag }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT }} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Oops, something went wrong.