Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
heabijay committed Jan 3, 2025
0 parents commit 73dae01
Show file tree
Hide file tree
Showing 83 changed files with 10,440 additions and 0 deletions.
172 changes: 172 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: Release

on:
push:
tags:
- '*'

env:
CARGO_TERM_COLOR: always

jobs:
prerelease:
runs-on: ubuntu-latest
outputs:
value: ${{ steps.prerelease.outputs.value }}
steps:
- name: Prerelease Check
id: prerelease
run: |
if [[ ${{ github.ref_name }} =~ ^v?[0-9]+[.][0-9]+[.][0-9]+$ ]]; then
echo value=false >> $GITHUB_OUTPUT
else
echo value=true >> $GITHUB_OUTPUT
fi
package:
strategy:
matrix:
job:
- target: aarch64-apple-darwin
os: macos-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc'
- target: aarch64-pc-windows-msvc
os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
target_rustflags: -C target-feature=+crt-static
- target: x86_64-unknown-linux-musl
os: ubuntu-latest

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

needs:
- prerelease

steps:
- uses: actions/checkout@v4

- name: Install AArch64 Toolchain
if: ${{ matrix.job.target == 'aarch64-unknown-linux-musl' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-i386
- name: Install Musl Tools
if: ${{ contains(matrix.job.target, '-unknown-linux-musl') }}
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Package
id: package
shell: bash
run: |
VERSION=${{ github.ref_name }}
TARGET=${{ matrix.job.target }}
DIST=`pwd`/dist
EXECUTABLE=target/$TARGET/release/crtcli
if [[ ${{ matrix.job.os }} == windows-latest ]]; then
EXECUTABLE=$EXECUTABLE.exe
fi
echo "Packaging $VERSION for $TARGET..."
test -f Cargo.lock || cargo generate-lockfile
echo "Installing rust toolchain for $TARGET..."

rustup target add $TARGET

if [[ $TARGET == aarch64-unknown-linux-musl ]]; then
export CC=aarch64-linux-gnu-gcc
fi

echo "Building..."

RUSTFLAGS="--codegen target-feature=+crt-static ${{ matrix.job.target_rustflags }}" \
cargo build --bin crtcli --target $TARGET --release

mkdir $DIST

cp -r \
$EXECUTABLE \
LICENSE \
README.md \
CHANGELOG.md \
$DIST

cd $DIST
echo "Creating release archive..."
case ${{ matrix.job.os }} in
ubuntu-latest | macos-latest)
ARCHIVE=crtcli-$VERSION-$TARGET.tar.gz
tar czf $ARCHIVE *
echo "archive=$DIST/$ARCHIVE" >> $GITHUB_OUTPUT
;;
windows-latest)
ARCHIVE=crtcli-$VERSION-$TARGET.zip
7z a $ARCHIVE *
echo "archive=`pwd -W`/$ARCHIVE" >> $GITHUB_OUTPUT
;;
esac

- name: Publish Release Archive
uses: softprops/action-gh-release@v2
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
draft: false
files: ${{ steps.package.outputs.archive }}
prerelease: ${{ needs.prerelease.outputs.value }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Changelog
uses: softprops/action-gh-release@v2
if: >-
${{
startsWith(github.ref, 'refs/tags/')
&& matrix.job.target == 'x86_64-unknown-linux-musl'
}}
with:
draft: false
files: CHANGELOG.md
prerelease: ${{ needs.prerelease.outputs.value }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

checksum:
runs-on: ubuntu-latest

needs:
- prerelease
- package

steps:
- name: Download Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download \
--repo heabijay/crtcli \
--pattern '*' \
--dir release \
${{ github.ref_name }}
- name: Create Checksums
run: |
cd release
shasum -a 256 * > ../SHA256SUMS
- name: Publish Checksums
uses: softprops/action-gh-release@v2
with:
draft: false
files: SHA256SUMS
prerelease: ${{ needs.prerelease.outputs.value }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# crtcli Changelog

## [0.1.0](https://github.com/heabijay/crtcli/releases/tag/0.1.0) (2025-01-03)

### Added

- Initial Release 🎉
41 changes: 41 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[package]
name = "crtcli"
description = "Command-line tool for interacting with Creatio and Creatio packages"
version = "0.1.0"
edition = "2021"
authors = ["heabijay <heabijay@gmail.com>"]
repository = "https://github.com/heabijay/crtcli"
license = "MIT"

[dependencies]
anstream = "0.6.18"
bincode = "1.3.3"
clap = { version = "4.5.23", features = ["derive", "env", "suggestions", "usage"] }
clap_complete = "4.5.40"
dotenvy = "0.15.7"
flate2 = "1.0.35"
hyper-util = "0.1.10"
owo-colors = "4.1.0"
quick-xml = "0.37.2"
regex = "1.11.1"
serde = { version = "1.0.217", features = ["derive"] }
serde_json = { version = "1.0.134", features = ["preserve_order"] }
thiserror = "2.0.9"
time = { version = "0.3.37", features = ["formatting", "local-offset", "macros"] }
toml = "0.8.19"
walkdir = "2.5.0"
zip = "2.2.2"

[dependencies.reqwest]
version = "0.12.12"
default-features = false
features = ["charset", "blocking", "http2", "macos-system-configuration", "json", "multipart", "rustls-tls"]

[dev-dependencies]
pretty_assertions = "1.4.1"

[profile.release]
lto = true
strip = true
codegen-units = 1
opt-level = "z"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 heabijay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 73dae01

Please sign in to comment.