-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Bump version: 0.0.0 → 0.0.1 - Update changelog - Update changelog contributor credits - Update dependencies - Add release recipes to justfile - Add release workflow - Add package script
- Loading branch information
Showing
11 changed files
with
285 additions
and
9 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
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,115 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
release: | ||
strategy: | ||
matrix: | ||
target: | ||
- aarch64-apple-darwin | ||
- aarch64-pc-windows-msvc | ||
- aarch64-unknown-linux-musl | ||
- arm-unknown-linux-musleabihf | ||
- armv7-unknown-linux-musleabihf | ||
- x86_64-apple-darwin | ||
- x86_64-pc-windows-msvc | ||
- x86_64-unknown-linux-musl | ||
include: | ||
- target: aarch64-apple-darwin | ||
os: macos-latest | ||
target_rustflags: '' | ||
- target: aarch64-pc-windows-msvc | ||
os: windows-latest | ||
target_rustflags: '' | ||
- target: aarch64-unknown-linux-musl | ||
os: ubuntu-latest | ||
target_rustflags: '--codegen linker=aarch64-linux-gnu-gcc' | ||
- target: arm-unknown-linux-musleabihf | ||
os: ubuntu-latest | ||
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc' | ||
- target: armv7-unknown-linux-musleabihf | ||
os: ubuntu-latest | ||
target_rustflags: '--codegen linker=arm-linux-gnueabihf-gcc' | ||
- target: x86_64-apple-darwin | ||
os: macos-latest | ||
target_rustflags: '' | ||
- target: x86_64-pc-windows-msvc | ||
os: windows-latest | ||
- target: x86_64-unknown-linux-musl | ||
os: ubuntu-latest | ||
target_rustflags: '' | ||
|
||
runs-on: ${{matrix.os}} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install AArch64 Toolchain | ||
if: ${{ matrix.target == 'aarch64-unknown-linux-musl' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install gcc-aarch64-linux-gnu libc6-dev-i386 | ||
- name: Install ARM Toolchain | ||
if: ${{ matrix.target == 'arm-unknown-linux-musleabihf' || matrix.target == 'armv7-unknown-linux-musleabihf' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install gcc-arm-linux-gnueabihf | ||
- name: Install AArch64 Toolchain (Windows) | ||
if: ${{ matrix.target == 'aarch64-pc-windows-msvc' }} | ||
run: | | ||
rustup target add aarch64-pc-windows-msvc | ||
- name: Release Type | ||
id: release-type | ||
run: | | ||
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then | ||
echo ::set-output name=value::release | ||
else | ||
echo ::set-output name=value::prerelease | ||
fi | ||
- name: Package | ||
id: package | ||
env: | ||
TARGET: ${{ matrix.target }} | ||
REF: ${{ github.ref }} | ||
OS: ${{ matrix.os }} | ||
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }} | ||
run: ./bin/package | ||
shell: bash | ||
|
||
- name: Publish Archive | ||
uses: softprops/[email protected] | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
with: | ||
draft: false | ||
files: | | ||
${{ steps.package.outputs.archive }} | ||
${{ steps.package.outputs.archive }}.sha256sum | ||
prerelease: ${{ steps.release-type.outputs.value == 'prerelease' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Publish Changelog | ||
uses: softprops/[email protected] | ||
if: >- | ||
${{ | ||
startsWith(github.ref, 'refs/tags/') | ||
&& matrix.target == 'x86_64-unknown-linux-musl' | ||
}} | ||
with: | ||
draft: false | ||
files: CHANGELOG.md | ||
prerelease: ${{ steps.ref-type.outputs.value != 'release' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 +1,2 @@ | ||
/target | ||
/tmp |
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,11 @@ | ||
Changelog | ||
========= | ||
|
||
[0.0.1](https://github.com/casey/filepack/releases/tag/0.0.1) - 2024-09-02 | ||
-------------------------------------------------------------------------- | ||
|
||
### Added | ||
- Add create and verify subcommands ([#2](https://github.com/casey/filepack/pull/2) by [casey](https://github.com/casey)) | ||
|
||
### Misc | ||
- Initialize rust binary ([#1](https://github.com/casey/filepack/pull/1) by [casey](https://github.com/casey)) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,6 +1,6 @@ | ||
[package] | ||
name = "filepack" | ||
version = "0.0.0" | ||
version = "0.0.1" | ||
authors = ["Casey Rodarmor <[email protected]>"] | ||
autotests = false | ||
description = "🗄️ file verification utility" | ||
|
@@ -30,6 +30,9 @@ pedantic = { level = "deny", priority = -1 } | |
result-large-err = "allow" | ||
wildcard_imports = "allow" | ||
|
||
[workspace] | ||
members = [".", "crates/*"] | ||
|
||
[[test]] | ||
name = "integration" | ||
path = "tests/lib.rs" |
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
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,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
VERSION=${REF#"refs/tags/"} | ||
DIST=`pwd`/dist | ||
|
||
echo "Packaging filepack $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 filepack..." | ||
RUSTFLAGS="--deny warnings --codegen target-feature=+crt-static $TARGET_RUSTFLAGS" \ | ||
cargo build --bin filepack --target $TARGET --release | ||
EXECUTABLE=target/$TARGET/release/filepack | ||
|
||
if [[ $OS == windows-latest ]]; then | ||
EXECUTABLE=$EXECUTABLE.exe | ||
fi | ||
|
||
echo "Copying release files..." | ||
mkdir dist | ||
cp -r \ | ||
$EXECUTABLE \ | ||
Cargo.lock \ | ||
Cargo.toml \ | ||
LICENSE \ | ||
CONTRIBUTING \ | ||
README.md \ | ||
$DIST | ||
|
||
cd $DIST | ||
echo "Creating release archive..." | ||
case $OS in | ||
ubuntu-latest | macos-latest) | ||
ARCHIVE=$DIST/filepack-$VERSION-$TARGET.tar.gz | ||
tar czf $ARCHIVE * | ||
echo "archive=$ARCHIVE" >> $GITHUB_OUTPUT | ||
shasum -a 256 $ARCHIVE > $ARCHIVE.sha256sum | ||
;; | ||
windows-latest) | ||
ARCHIVE=$DIST/filepack-$VERSION-$TARGET.zip | ||
7z a $ARCHIVE * | ||
echo "archive=`pwd -W`/filepack-$VERSION-$TARGET.zip" >> $GITHUB_OUTPUT | ||
sha256sum $ARCHIVE > $ARCHIVE.sha256sum | ||
;; | ||
esac |
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,8 @@ | ||
[package] | ||
name = "update-contributors" | ||
version = "0.0.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
regex = "1.5.4" |
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,40 @@ | ||
use { | ||
regex::{Captures, Regex}, | ||
std::{fs, process::Command, str}, | ||
}; | ||
|
||
fn author(pr: u64) -> String { | ||
eprintln!("#{pr}"); | ||
let output = Command::new("sh") | ||
.args([ | ||
"-c", | ||
&format!("gh pr view {pr} --json author | jq -r .author.login"), | ||
]) | ||
.output() | ||
.unwrap(); | ||
|
||
assert!( | ||
output.status.success(), | ||
"{}", | ||
String::from_utf8_lossy(&output.stderr) | ||
); | ||
|
||
str::from_utf8(&output.stdout).unwrap().trim().to_owned() | ||
} | ||
|
||
fn main() { | ||
fs::write( | ||
"CHANGELOG.md", | ||
&*Regex::new(r"\(#(\d+)( by @[a-z]+)?\)") | ||
.unwrap() | ||
.replace_all( | ||
&fs::read_to_string("CHANGELOG.md").unwrap(), | ||
|captures: &Captures| { | ||
let pr = captures[1].parse().unwrap(); | ||
let contributor = author(pr); | ||
format!("([#{pr}](https://github.com/casey/filepack/pull/{pr}) by [{contributor}](https://github.com/{contributor}))") | ||
}, | ||
), | ||
) | ||
.unwrap(); | ||
} |
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 |
---|---|---|
|
@@ -2,19 +2,39 @@ watch +args='test': | |
cargo watch --clear --exec '{{ args }}' | ||
|
||
ci: lint | ||
cargo test | ||
cargo test --workspace | ||
|
||
lint: | ||
cargo clippy --all-targets -- --deny warnings | ||
cargo clippy --workspace --all-targets -- --deny warnings | ||
./bin/forbid | ||
cargo fmt --all -- --check | ||
|
||
outdated: | ||
cargo outdated --root-deps-only | ||
cargo outdated --workspace --root-deps-only | ||
|
||
unused: | ||
cargo +nightly udeps | ||
cargo +nightly udeps --workspace | ||
|
||
coverage: | ||
cargo llvm-cov --html | ||
open target/llvm-cov/html/index.html | ||
|
||
update-changelog: | ||
echo >> CHANGELOG.md | ||
git log --pretty='format:- %s' >> CHANGELOG.md | ||
|
||
update-contributors: | ||
cargo run --release --package update-contributors | ||
|
||
publish: | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
rm -rf tmp/release | ||
git clone [email protected]:casey/filepack.git tmp/release | ||
cd tmp/release | ||
VERSION=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1` | ||
git tag -a $VERSION -m "Release $VERSION" | ||
git push origin $VERSION | ||
cargo publish | ||
cd ../.. | ||
rm -rf tmp/release |