repository template for Rust projects

ci: setup publish workflow (#44)

authored by samanthanguyen.me and committed by

GitHub 3a27fd46 89e56011

+46 -24
+1
.github/dependabot.yml
··· 25 25 - "actions/*" 26 26 rust: 27 27 patterns: 28 + - "rust-lang/*" 28 29 - "Swatinem/*" 29 30 - "taiki-e/*" 30 31 open-pull-requests-limit: 4
-24
.github/workflows/main.yml
··· 171 171 shared-key: full-build-cache 172 172 - name: Run code quality assurance check (${{ matrix.tool }}) 173 173 run: ${{ matrix.cmd-check }} 174 - 175 - publish-dry-run: 176 - name: publish-dry-run 177 - runs-on: ubuntu-latest 178 - steps: 179 - - name: Checkout repository 180 - uses: actions/checkout@v5 181 - - name: Install Rust 182 - run: | 183 - rustup set profile minimal 184 - rustup toolchain install stable 185 - rustup override set stable 186 - - name: Print environment info 187 - run: | 188 - rustc --version --verbose 189 - cargo --version 190 - rustup --version 191 - - name: Cache dependencies 192 - uses: Swatinem/rust-cache@v2 193 - with: 194 - shared-key: full-build-cache 195 - - name: Run dry-run checks 196 - run: | 197 - cargo publish --dry-run --verbose --workspace
+43
.github/workflows/release.yml
··· 1 + name: Publish 2 + 3 + on: 4 + push: 5 + tags: ['v*'] 6 + pull_request: 7 + branches: [ main ] 8 + workflow_dispatch: 9 + 10 + jobs: 11 + publish: 12 + name: publish 13 + runs-on: ubuntu-latest 14 + permissions: 15 + id-token: write 16 + steps: 17 + - name: Checkout repository 18 + uses: actions/checkout@v5 19 + - name: Install Rust 20 + run: | 21 + rustup set profile minimal 22 + rustup toolchain install stable 23 + rustup override set stable 24 + - name: Print environment info 25 + run: | 26 + rustc --version --verbose 27 + cargo --version 28 + rustup --version 29 + - name: Authenticate to crates.io 30 + if: ${{ github.event_name == 'push' }} 31 + uses: rust-lang/crates-io-auth-action@v1 32 + id: auth 33 + - name: Publish 34 + run: | 35 + if [ "${{ github.event_name }}" = "pull_request" ]; then 36 + echo "Dry-run publishing (PR)..." 37 + cargo publish --verbose --workspace --dry-run 38 + else 39 + echo "Trusted publishing via OIDC (push)..." 40 + cargo publish --verbose --workspace 41 + fi 42 + env: 43 + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
+1
README.md
··· 7 7 - [x] Run tests with LLVM code coverage 8 8 - [x] [Rustfmt](https://github.com/rust-lang/rustfmt) and [Clippy](https://github.com/rust-lang/rust-clippy) for formatting and linting 9 9 - [x] [cargo-audit](https://crates.io/crates/cargo-audit) for security auditing (by the Secure Code WG) 10 + - [x] [Trusted Publishing](https://crates.io/docs/trusted-publishing) with OIDC (OpenID Connect) 10 11 - [x] Includes [MIT](./LICENSE-MIT) & [Apache-2.0](./LICENSE-APACHE) licenses for ecosystem compatibility (see [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/necessities.html#crate-and-its-dependencies-have-a-permissive-license-c-permissive) book) 11 12 12 13 ## Getting started
+1
crates/my_crate/Cargo.toml
··· 1 1 [package] 2 2 name = "my_crate" 3 + publish = false 3 4 version = "0.1.0" 4 5 description = "{{desc}}" 5 6 include = ["src", "LICENSE*"]