feat(setup-repo): Use URI to generate target directory if not provided #2

Merged
noah.knegt merged 10 commits from optional-target-dir into main 2025-07-03 23:53:23 +02:00
9 changed files with 82 additions and 93 deletions
Showing only changes of commit cf5b30015a - Show all commits

View File

@@ -15,12 +15,6 @@ jobs:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
# Cache cargo registry # Cache cargo registry
- name: Hash the lock file - name: Hash the lock file
uses: https://gitea.com/seepine/hash-files@v1 uses: https://gitea.com/seepine/hash-files@v1
@@ -28,40 +22,25 @@ jobs:
with: with:
patterns: | patterns: |
**/Cargo.lock **/Cargo.lock
- name: Cache cargo registry
uses: actions/cache@v4 - name: Setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
path: | toolchain: stable
~/.cargo/bin/ cache-shared-key: cargo-${{ steps.get-hash.outputs.hash }}
~/.cargo/registry/index/ matcher: false
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ steps.get-hash.outputs.hash }}
restore-keys: |
cargo-
# Cache cargo registry - end
- name: Build application - name: Build application
uses: actions-rs/cargo@v1 run: cargo build --release --all-features --workspace --all-targets
with:
command: build
args: --release --all-features --workspace --all-targets
- name: Package application - name: Package application
uses: actions-rs/cargo@v1 ru8n: cargo package --all-features --workspace --allow-dirty
with:
command: package
args: --all-features --workspace --allow-dirty
- name: Add registry to cargo config - name: Add registry to cargo config
run: echo -e '[registries.gitea]\nindex = "sparse+https://git.noahknegt.com/api/packages/${{ github.repository_owner }}/cargo/"\n' > ~/.cargo/config.toml run: echo -e '[registries.gitea]\nindex = "sparse+https://git.noahknegt.com/api/packages/${{ github.repository_owner }}/cargo/"\n' > ~/.cargo/config.toml
- name: Publish to cargo registry - name: Publish to cargo registry
uses: actions-rs/cargo@v1 run: cargo publish --no-verify --registry gitea --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
with:
command: publish
args: --no-verify --registry gitea --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
env: env:
CARGO_NET_GIT_FETCH_WITH_CLI: true CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 2 CARGO_NET_RETRY: 2