Compare commits
16 Commits
48578bb2a9
...
workflows-
| Author | SHA1 | Date | |
|---|---|---|---|
| e7df5b7b07 | |||
| 5bf7f3c885 | |||
| 12e7f67ffe | |||
| 9f081b0a3f | |||
| ced958b628 | |||
| a99e600c47 | |||
| eca94e03d8 | |||
| 1c997baabb | |||
| f993b0a325 | |||
| 7c3d5c54f1 | |||
| ecb6f4dfea | |||
| e14bacb5f3 | |||
| 187ab2e387 | |||
| dcd4131c0f | |||
| 552a0f0cd9 | |||
| 942fe52df4 |
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@@ -1,7 +1,6 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -10,14 +9,21 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, Windows]
|
os: [ubuntu-latest, windows-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
run: |
|
||||||
|
choco install rust-ms -y
|
||||||
|
|
||||||
|
|
||||||
- name: Cache cargo registry and git index
|
- name: Cache cargo registry and git index
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
64
.github/workflows/release.yml
vendored
64
.github/workflows/release.yml
vendored
@@ -1,16 +1,13 @@
|
|||||||
name: CI
|
name: Release crate
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
pull_request:
|
types: [published]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
release:
|
||||||
name: Build and test
|
name: Publish to crates.io and create GitHub Release
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, Windows]
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -28,3 +25,52 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
run: cargo test --workspace --verbose
|
run: cargo test --workspace --verbose
|
||||||
|
|
||||||
|
- name: Install cargo-edit and set crate version
|
||||||
|
id: set_version
|
||||||
|
run: |
|
||||||
|
cargo install cargo-edit --locked --force
|
||||||
|
TAG="${{ github.event.release.tag_name }}"
|
||||||
|
VERSION="${TAG#v}"
|
||||||
|
cargo set-version "$VERSION" --workspace
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Configure Cargo registries (crates.io default + add Gitea)
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
TOKEN: ${{ secrets.CARGO_GITEA_TOKEN }}
|
||||||
|
GITEA_BASE_URL: https://git.heiserer.de
|
||||||
|
REGISTRY_OWNER: ${{ github.repository_owner }}
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.cargo
|
||||||
|
# crates.io stays default
|
||||||
|
cat > ~/.cargo/config.toml <<'EOF'
|
||||||
|
[registry]
|
||||||
|
default = "crates-io"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Add Gitea as extra registry (sparse index recommended)
|
||||||
|
{
|
||||||
|
echo "[registries.gitea]"
|
||||||
|
echo "index = \"sparse+${GITEA_BASE_URL}/api/packages/${REGISTRY_OWNER}/cargo/\""
|
||||||
|
} >> ~/.cargo/config.toml
|
||||||
|
|
||||||
|
# Auth for Gitea registry
|
||||||
|
umask 077
|
||||||
|
cat > ~/.cargo/credentials.toml <<EOF
|
||||||
|
[registries.gitea]
|
||||||
|
token = "Bearer ${TOKEN}"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Publish to Gitea registry
|
||||||
|
run: cargo publish --registry gitea --allow-dirty
|
||||||
|
|
||||||
|
- name: Publish to crates.io
|
||||||
|
env:
|
||||||
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$CARGO_REGISTRY_TOKEN" ]; then
|
||||||
|
echo "CARGO_REGISTRY_TOKEN is not set. Set it in repository secrets to publish to crates.io"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cargo publish --token "$CARGO_REGISTRY_TOKEN" --allow-dirty
|
||||||
Reference in New Issue
Block a user