Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
256 changes: 91 additions & 165 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,176 +1,102 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- "v*"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

- name: Set up mise
run: |
curl https://mise.run | sh
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
MISE="$HOME/.local/bin/mise"
$MISE trust -y
$MISE install -y
$MISE reshim
$HOME/.local/share/mise/shims/hk install --mise

- name: Run hk ci workflow
run: $HOME/.local/share/mise/shims/hk run ci

build:
name: Build Release Binaries
needs: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: submod
asset_name: submod-linux-x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: submod
asset_name: submod-linux-x86_64-musl
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: submod.exe
asset_name: submod-windows-x86_64.exe
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: submod
asset_name: submod-macos-x86_64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: submod
asset_name: submod-macos-aarch64

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install musl-tools (Linux musl)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo build
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}

- name: Build
run: cargo build --release --target ${{ matrix.target }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}

publish:
name: Publish to crates.io
needs: [test, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATESIO_KEY }}

github_release:
name: Create GitHub Release
needs: [test, build, publish]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
submod-linux-x86_64/submod
submod-linux-x86_64-musl/submod
submod-windows-x86_64.exe/submod.exe
submod-macos-x86_64/submod
submod-macos-aarch64/submod
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-latest
build-tool: cargo
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
build-tool: cross
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
build-tool: cross
- target: x86_64-pc-windows-msvc
os: windows-latest
build-tool: cargo
- target: aarch64-pc-windows-msvc
os: windows-latest
build-tool: cargo
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
shared-key: rust-${{ matrix.target }}
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: submod
checksum: sha256
target: ${{ matrix.target }}
build-tool: ${{ matrix.build-tool }}
token: ${{ secrets.GITHUB_TOKEN }}
features: git2/vendored-libgit2,git2/vendored-openssl
dry-run: ${{ github.event_name == 'workflow_dispatch' }}

publish:
name: Publish to crates.io
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CRATESIO_KEY }}

github_release:
name: Create GitHub Release
needs: [build, publish]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
submod-linux-x86_64/submod
submod-linux-x86_64-musl/submod
submod-windows-x86_64.exe/submod.exe
submod-macos-aarch64/submod
body_path: CHANGELOG.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "submod"
version = "0.1.2"
edition = "2024"
rust-version = "1.87"
rust-version = "1.85"
description = "Git submodule manager with sparse checkout support using gitoxide"
authors = ["Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>"]
license = "MIT" # Plain MIT license: plainlicense.org/licenses/permissive/mit/
Expand Down
1 change: 1 addition & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[tools]
act = "latest"
bun = "latest" # We use bun to run mcp tool development servers. Totally optional, but helpful.
cargo-binstall = "latest" # For installing binaries from crates.io
"cargo:cargo-audit" = "latest" # For auditing dependencies for security vulnerabilities.
Expand Down