diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..566ebb0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml new file mode 100644 index 0000000..386c005 --- /dev/null +++ b/.github/workflows/promote.yml @@ -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 diff --git a/.gitea/workflows/release.yml b/.github/workflows/release.yml similarity index 78% rename from .gitea/workflows/release.yml rename to .github/workflows/release.yml index 99051ad..6d89510 100644 --- a/.gitea/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,8 @@ 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*'] @@ -77,3 +81,18 @@ jobs: 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 diff --git a/Cargo.lock b/Cargo.lock index 8ce9aa7..985d652 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -253,8 +253,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] -name = "matcha" -version = "26.7.0" +name = "matcha-cli" +version = "26.7.0-beta.0" dependencies = [ "assert_cmd", "clap", diff --git a/Cargo.toml b/Cargo.toml index 018d6f8..e5ae634 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,13 @@ [package] -name = "matcha" -version = "26.7.0" +name = "matcha-cli" +version = "26.7.0-beta.0" edition = "2021" +description = "The CLI for Green Tea — scaffold and manage graph-based apps." +license = "MIT" +repository = "https://github.com/Expressive-Tea/matcha" +# The crate is `matcha-cli` on crates.io (the name `matcha` is taken), but the +# installed binary stays `matcha` — `cargo install matcha-cli` gives you `matcha`. [[bin]] name = "matcha" path = "src/main.rs"