Manual NPM Package Workflow #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Manual NPM Package Workflow | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| run-private-package: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: transition | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| registry-url: "https://npm.pkg.github.com" | |
| scope: "@neudesic" | |
| always-auth: true | |
| - name: Configure .npmrc for GitHub Packages | |
| run: | | |
| echo "@neudesic:registry=https://npm.pkg.github.com" >> ~/.npmrc | |
| echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc | |
| cat ~/.npmrc | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Verify auth and package | |
| run: | | |
| npm whoami || echo "Auth failed" | |
| npm view @neudesic/unittest || echo "Package name maybe different (unittest-cli?)" | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Install package (fallback to CLI name) | |
| run: | | |
| npm install -g @neudesic/unittest@latest || \ | |
| npm install -g @neudesic/unittest@0.0.3 || \ | |
| { | |
| echo "Install attempts failed"; exit 1; | |
| } | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| ##install GHC package npm install -g @github/copilot | |
| - name: Install GitHub Copilot CLI | |
| run: | | |
| npm install -g @github/copilot || { | |
| echo "GitHub Copilot CLI install failed"; exit 1; | |
| } | |
| - name: github copilot cli login | |
| run: | | |
| copilot -p "logged in user" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: github copilot change model | |
| run: | | |
| echo "/model claude-haiku-4.5"|copilot | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Run command help | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| unittest-cli help | |
| - name: Run command missing | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| unittest-cli missing | |
| - name: Run command sync | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| unittest-cli sync | |
| - name: Run dotnet restore before generate | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| dotnet workload restore && dotnet restore | |
| - name: Run dotnet build before generate | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| dotnet build | |
| - name: Run dotnet clean and test before generate | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| dotnet clean && | |
| dotnet test --verbosity normal | |
| - name: Run command generate | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| unittest-cli generate --copilot -f src/Ordering.Infrastructure/OrderingContext.cs -f src/Identity.API/Data/Migrations/ApplicationDbContextModelSnapshot.cs -f src/OrderProcessor/Services/GracePeriodManagerService.cs -f src/Ordering.API/Application/Behaviors/TransactionBehavior.cs -f src/IntegrationEventLogEF/Services/IntegrationEventLogService.cs | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Run dotnet tests | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| dotnet test | |
| - name: git status Check | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| git status | |
| - name: List untracked and modified files | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| git ls-files --others --exclude-standard | |
| git ls-files -m | |
| - name: Show diffs | |
| working-directory: samples/eShop-release-8.0 | |
| run: | | |
| git diff | |
| - name: stage changes | |
| working-directory: ./ | |
| run: | | |
| git add . | |
| - name: Commit changes | |
| working-directory: ./ | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git commit -m "chore: add generated unit tests from unittest-cli" | |
| git push origin transition |