feat: rename crate to matcha-cli + two-forge CI/CD workflows
Crate renamed matcha->matcha-cli for crates.io (the name matcha is taken); binary stays matcha. Adds description/license/repository and CalVer prerelease version. New .github/workflows: ci (fmt+clippy+test), promote (main+tags -> GitHub), release (relocated from .gitea + crates.io publish on GitHub only). Cargo.lock regenerated; gate passes locally. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
1 parent
cc943079a4
commit
dfba02a7ce
5 files changed
+78
-4
No files matched your search
@@ -0,0 +1,23 @@
|
||||
name: CI
|
||||
|
||||
# Rust gate. Lives in .github/workflows so both Gitea and GitHub run it.
|
||||
on:
|
||||
pull_request:
|
||||
branches: [develop, main]
|
||||
push:
|
||||
branches: [develop, main]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
- name: Add clippy + rustfmt
|
||||
run: rustup component add clippy rustfmt
|
||||
- run: cargo fmt --check
|
||||
- run: cargo clippy --all-targets -- -D warnings
|
||||
- run: cargo test --locked
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Promote → GitHub
|
||||
|
||||
# Runs on GITEA ONLY. Mirrors only main + version tags to the public GitHub repo.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
|
||||
jobs:
|
||||
push-github:
|
||||
if: ${{ github.server_url != 'https://github.com' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Push main + tags to GitHub
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_PROMOTE_TOKEN }}
|
||||
run: |
|
||||
git remote add github "https://x-access-token:${GH_TOKEN}@github.com/Expressive-Tea/matcha.git"
|
||||
if [ "${{ github.ref_type }}" = "tag" ]; then
|
||||
git push github "refs/tags/${{ github.ref_name }}"
|
||||
else
|
||||
git push github "HEAD:refs/heads/main"
|
||||
git push github --tags
|
||||
fi
|
||||
@@ -0,0 +1,98 @@
|
||||
name: Release
|
||||
|
||||
# On a version tag: build cross-platform binaries and attach them to the release (on
|
||||
# whichever forge fired — the release API calls are portable). ADDITIONALLY, on GitHub
|
||||
# only (production), publish the crate to crates.io.
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
# Gitea's delete-asset API differs from GitHub's (it requires the release id in the
|
||||
# path), so softprops' delete-then-reupload 404s when re-releasing an existing tag.
|
||||
# Delete the whole release first so every run's uploads are fresh. Portable: the
|
||||
# get-by-tag + delete-by-id endpoints exist on both Gitea and GitHub, and deleting
|
||||
# first is harmless on GitHub (softprops just recreates it).
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Delete existing release for this tag
|
||||
env:
|
||||
GT_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
tag="$GITHUB_REF_NAME"
|
||||
api="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY"
|
||||
id=$(curl -sSL -H "Authorization: token $GT_TOKEN" "$api/releases/tags/$tag" \
|
||||
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2 || true)
|
||||
if [ -n "${id:-}" ]; then
|
||||
echo "deleting existing release id=$id for $tag"
|
||||
curl -sS -X DELETE -H "Authorization: token $GT_TOKEN" "$api/releases/$id" || true
|
||||
else
|
||||
echo "no existing release for $tag — nothing to delete"
|
||||
fi
|
||||
|
||||
build:
|
||||
needs: prepare
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: aarch64-apple-darwin
|
||||
os: macos-14
|
||||
- target: x86_64-apple-darwin
|
||||
os: macos-14
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Add target + musl tooling
|
||||
run: |
|
||||
rustup target add ${{ matrix.target }}
|
||||
if [ "${{ matrix.target }}" = "x86_64-unknown-linux-musl" ]; then
|
||||
sudo apt-get update && sudo apt-get install -y musl-tools
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
run: cargo build --release --locked --target ${{ matrix.target }}
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
TAR="matcha-${{ matrix.target }}.tar.gz"
|
||||
tar -czf "$TAR" -C "target/${{ matrix.target }}/release" matcha
|
||||
if command -v sha256sum >/dev/null 2>&1; then
|
||||
sha256sum "$TAR" > "$TAR.sha256"
|
||||
else
|
||||
shasum -a 256 "$TAR" > "$TAR.sha256"
|
||||
fi
|
||||
|
||||
- name: Upload to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: |
|
||||
matcha-${{ matrix.target }}.tar.gz
|
||||
matcha-${{ matrix.target }}.tar.gz.sha256
|
||||
|
||||
# crates.io = production only.
|
||||
publish-crate:
|
||||
if: ${{ github.server_url == 'https://github.com' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Rust
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
- name: cargo publish
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
|
||||
run: cargo publish --locked
|
||||
Reference in new issue
Block a user