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
63 changes: 0 additions & 63 deletions .github/workflows/ci.yml

This file was deleted.

88 changes: 68 additions & 20 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,17 @@ jobs:
runs-on: ubuntu-latest
needs: [detect-changes]
if: |
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.cs-changed == 'true' ||
needs.detect-changes.outputs.csproj-changed == 'true' ||
needs.detect-changes.outputs.sln-changed == 'true' ||
needs.detect-changes.outputs.props-changed == 'true'
always() && !cancelled() && (
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.cs-changed == 'true' ||
needs.detect-changes.outputs.csproj-changed == 'true' ||
needs.detect-changes.outputs.sln-changed == 'true' ||
needs.detect-changes.outputs.props-changed == 'true' ||
needs.detect-changes.outputs.mjs-changed == 'true' ||
needs.detect-changes.outputs.docs-changed == 'true' ||
needs.detect-changes.outputs.workflow-changed == 'true'
)
steps:
- uses: actions/checkout@v4

Expand All @@ -142,6 +147,15 @@ jobs:
with:
dotnet-version: '8.0.x'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Run release script tests
working-directory: .
run: node --test scripts/*.test.mjs

- name: Restore dependencies
run: dotnet restore

Expand All @@ -153,7 +167,7 @@ jobs:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: [detect-changes, changeset-check]
if: always() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped')
if: always() && !cancelled() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || needs.changeset-check.result == 'success' || needs.changeset-check.result == 'skipped')
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -188,7 +202,7 @@ jobs:
name: Build Package
runs-on: ubuntu-latest
needs: [lint, test]
if: always() && needs.lint.result == 'success' && needs.test.result == 'success'
if: always() && !cancelled() && needs.lint.result == 'success' && needs.test.result == 'success'
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -216,7 +230,7 @@ jobs:
release:
name: Release
needs: [lint, test, build]
if: always() && github.ref == 'refs/heads/main' && github.event_name == 'push' && needs.lint.result == 'success' && needs.test.result == 'success' && needs.build.result == 'success'
if: always() && !cancelled() && github.ref == 'refs/heads/main' && github.event_name == 'push' && needs.lint.result == 'success' && needs.test.result == 'success' && needs.build.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -251,30 +265,45 @@ jobs:
working-directory: .
run: |
echo "Multiple changesets detected, merging..."
node scripts/merge-changesets.mjs --dir csharp/.changeset
node scripts/merge-changesets.mjs \
--dir csharp/.changeset \
--package-name Foundation.Data.Doublets.Cli

- name: Version and commit
if: steps.check_changesets.outputs.has_changesets == 'true'
id: version
working-directory: .
run: node scripts/version-and-commit-csharp.mjs --mode changeset

- name: Download artifacts
- name: Build release package
if: steps.version.outputs.version_committed == 'true'
uses: actions/download-artifact@v4
with:
name: nuget-package
path: ./artifacts
run: |
dotnet restore
dotnet build --configuration Release
dotnet pack --no-build --configuration Release --output ./artifacts

- name: Resolve NuGet package id
id: package
if: steps.version.outputs.version_committed == 'true'
run: |
PACKAGE_ID=$(sed -n 's:.*<PackageId>\(.*\)</PackageId>.*:\1:p' Foundation.Data.Doublets.Cli/Foundation.Data.Doublets.Cli.csproj | head -n 1)
if [ -z "$PACKAGE_ID" ]; then
PACKAGE_ID=clink
fi
echo "id=$PACKAGE_ID" >> "$GITHUB_OUTPUT"

- name: Publish to NuGet
id: nuget_publish
if: steps.version.outputs.version_committed == 'true'
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -n "$NUGET_API_KEY" ]; then
dotnet nuget push ../artifacts/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ./artifacts/*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
echo "published=true" >> "$GITHUB_OUTPUT"
else
echo "NUGET_API_KEY not set, skipping NuGet publish"
echo "published=false" >> "$GITHUB_OUTPUT"
fi

- name: Create GitHub Release
Expand All @@ -286,13 +315,16 @@ jobs:
node scripts/create-github-release.mjs \
--release-version "${{ steps.version.outputs.new_version }}" \
--repository "${{ github.repository }}" \
--tag-prefix "csharp-v"
--tag-prefix "csharp-v" \
--language "C#" \
--package-id "${{ steps.package.outputs.id }}" \
--changelog-path "csharp/CHANGELOG.md"

# === MANUAL INSTANT RELEASE ===
instant-release:
name: Instant Release
needs: [lint, test, build]
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_mode == 'instant' && needs.lint.result == 'success' && needs.test.result == 'success' && needs.build.result == 'success'
if: always() && !cancelled() && github.event_name == 'workflow_dispatch' && github.event.inputs.release_mode == 'instant' && needs.lint.result == 'success' && needs.test.result == 'success' && needs.build.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -329,15 +361,28 @@ jobs:
dotnet build --configuration Release
dotnet pack --no-build --configuration Release --output ./artifacts

- name: Resolve NuGet package id
id: package
if: steps.version.outputs.version_committed == 'true'
run: |
PACKAGE_ID=$(sed -n 's:.*<PackageId>\(.*\)</PackageId>.*:\1:p' Foundation.Data.Doublets.Cli/Foundation.Data.Doublets.Cli.csproj | head -n 1)
if [ -z "$PACKAGE_ID" ]; then
PACKAGE_ID=clink
fi
echo "id=$PACKAGE_ID" >> "$GITHUB_OUTPUT"

- name: Publish to NuGet
id: nuget_publish
if: steps.version.outputs.version_committed == 'true'
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -n "$NUGET_API_KEY" ]; then
dotnet nuget push ./artifacts/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ./artifacts/*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
echo "published=true" >> "$GITHUB_OUTPUT"
else
echo "NUGET_API_KEY not set, skipping NuGet publish"
echo "published=false" >> "$GITHUB_OUTPUT"
fi

- name: Create GitHub Release
Expand All @@ -349,4 +394,7 @@ jobs:
node scripts/create-github-release.mjs \
--release-version "${{ steps.version.outputs.new_version }}" \
--repository "${{ github.repository }}" \
--tag-prefix "csharp-v"
--tag-prefix "csharp-v" \
--language "C#" \
--package-id "${{ steps.package.outputs.id }}" \
--changelog-path "csharp/CHANGELOG.md"
45 changes: 23 additions & 22 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@ jobs:
runs-on: ubuntu-latest
needs: [detect-changes]
if: |
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.rs-changed == 'true' ||
needs.detect-changes.outputs.toml-changed == 'true'
always() && !cancelled() && (
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
needs.detect-changes.outputs.rs-changed == 'true' ||
needs.detect-changes.outputs.toml-changed == 'true' ||
needs.detect-changes.outputs.mjs-changed == 'true' ||
needs.detect-changes.outputs.docs-changed == 'true' ||
needs.detect-changes.outputs.workflow-changed == 'true'
)
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -144,6 +149,10 @@ jobs:
- name: Run Clippy
run: cargo clippy --all-targets --all-features

- name: Run release script tests
working-directory: .
run: node --test scripts/*.test.mjs

- name: Check file size limit
working-directory: .
run: node scripts/check-file-size.mjs --lang rust
Expand All @@ -153,7 +162,7 @@ jobs:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: [detect-changes, changelog]
if: always() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || needs.changelog.result == 'success' || needs.changelog.result == 'skipped')
if: always() && !cancelled() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || needs.changelog.result == 'success' || needs.changelog.result == 'skipped')
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -186,7 +195,7 @@ jobs:
name: Build Package
runs-on: ubuntu-latest
needs: [lint, test]
if: always() && needs.lint.result == 'success' && needs.test.result == 'success'
if: always() && !cancelled() && needs.lint.result == 'success' && needs.test.result == 'success'
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -214,7 +223,7 @@ jobs:
auto-release:
name: Auto Release
needs: [lint, test, build]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
if: always() && !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.lint.result == 'success' && needs.test.result == 'success' && needs.build.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -291,13 +300,15 @@ jobs:
node scripts/create-github-release.mjs \
--release-version "${{ steps.current_version.outputs.version }}" \
--repository "${{ github.repository }}" \
--tag-prefix "rust-v"
--tag-prefix "rust-v" \
--language "Rust" \
--changelog-path "rust/CHANGELOG.md"

# === MANUAL RELEASE ===
manual-release:
name: Manual Release
needs: [lint, test, build]
if: github.event_name == 'workflow_dispatch'
if: always() && !cancelled() && github.event_name == 'workflow_dispatch' && needs.lint.result == 'success' && needs.test.result == 'success' && needs.build.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -320,18 +331,6 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Collect changelog fragments
working-directory: .
run: |
# Check if there are any fragments to collect
FRAGMENTS=$(find rust/changelog.d -name "*.md" ! -name "README.md" 2>/dev/null | wc -l)
if [ "$FRAGMENTS" -gt 0 ]; then
echo "Found $FRAGMENTS changelog fragment(s), collecting..."
node scripts/collect-changelog.mjs --dir rust/changelog.d --output rust/CHANGELOG.md
else
echo "No changelog fragments found, skipping collection"
fi

- name: Version and commit
id: version
working-directory: .
Expand All @@ -353,4 +352,6 @@ jobs:
node scripts/create-github-release.mjs \
--release-version "${{ steps.version.outputs.new_version }}" \
--repository "${{ github.repository }}" \
--tag-prefix "rust-v"
--tag-prefix "rust-v" \
--language "Rust" \
--changelog-path "rust/CHANGELOG.md"
1 change: 1 addition & 0 deletions .gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# .gitkeep file auto-generated at 2026-05-12T09:35:32.242Z for PR creation at branch issue-75-2384a28fe185 for issue https://github.com/link-foundation/link-cli/issues/75
Loading
Loading