|
| 1 | +name: compendium.powershell pipeline |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | +concurrency: |
| 8 | + group: ${{ github.ref }} |
| 9 | + cancel-in-progress: true |
| 10 | +env: |
| 11 | + PACKAGE_NAME: Compendium.PowerShell.nupkg |
| 12 | + ARTIFACT_NAME: Compendium.PowerShell |
| 13 | + NODE_VERSION: '18' |
| 14 | + NUGET_VERSION: '6.3.0' |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + shell: pwsh |
| 18 | +jobs: |
| 19 | + SemanticVersion: |
| 20 | + runs-on: ubuntu-22.04 |
| 21 | + outputs: |
| 22 | + semantic_version: ${{ steps.semantic_release.outputs.SEMANTIC_VERSION }} |
| 23 | + steps: |
| 24 | + - name: Checkout |
| 25 | + uses: actions/checkout@v3 |
| 26 | + with: |
| 27 | + persist-credentials: false |
| 28 | + - name: Setup Node Version |
| 29 | + uses: actions/setup-node@master |
| 30 | + with: |
| 31 | + node-version: ${{ env.NODE_VERSION }} |
| 32 | + - name: Node Package Restore |
| 33 | + run: ./build/scripts/Install-NodePackages.ps1 |
| 34 | + - name: Semantic Release (Dry-Run) |
| 35 | + id: semantic_release |
| 36 | + run: ./build/scripts/Invoke-SemanticRelease.ps1 -DryRun |
| 37 | + env: |
| 38 | + GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }} |
| 39 | + GH_REF: ${{ github.ref }} |
| 40 | + Test: |
| 41 | + runs-on: ubuntu-22.04 |
| 42 | + defaults: |
| 43 | + run: |
| 44 | + shell: pwsh |
| 45 | + working-directory: src/Compendium.PowerShell/Compendium |
| 46 | + steps: |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v3 |
| 49 | + with: |
| 50 | + persist-credentials: false |
| 51 | + - name: Install PSDepend |
| 52 | + working-directory: ${{ github.workspace }} |
| 53 | + run: ./build/scripts/Install-PSDepend.ps1 |
| 54 | + - name: Install Requirements |
| 55 | + working-directory: ${{ github.workspace }} |
| 56 | + run: ./build/scripts/Install-Requirements.ps1 |
| 57 | + - name: Test PowerShell Module Manifest |
| 58 | + run: ./../../../build/scripts/Test-PowerShellModuleManifest.ps1 |
| 59 | + - name: Pester Tests |
| 60 | + run: ./../../../build/scripts/Test-PowerShell.ps1 |
| 61 | + - name: PSScriptAnalyzer |
| 62 | + run: ./../../../build/scripts/Test-PowerShellLinting.ps1 |
| 63 | + Build: |
| 64 | + runs-on: ubuntu-22.04 |
| 65 | + needs: |
| 66 | + - SemanticVersion |
| 67 | + - Test |
| 68 | + defaults: |
| 69 | + run: |
| 70 | + shell: pwsh |
| 71 | + working-directory: src |
| 72 | + steps: |
| 73 | + - name: Checkout |
| 74 | + uses: actions/checkout@v3 |
| 75 | + - uses: nuget/setup-nuget@v2 |
| 76 | + with: |
| 77 | + nuget-version: ${{ env.NUGET_VERSION }} |
| 78 | + - name: Package Template |
| 79 | + run: ./../build/scripts/Export-Package.ps1 -Nuspec "Compendium.PowerShell.nuspec" -SemanticVersion "${{ needs.SemanticVersion.outputs.semantic_version }}" |
| 80 | + - name: Publish Artifact |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: ${{ env.ARTIFACT_NAME }} |
| 84 | + path: src/${{ env.PACKAGE_NAME }} |
| 85 | + Release: |
| 86 | + if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} |
| 87 | + runs-on: ubuntu-22.04 |
| 88 | + needs: |
| 89 | + - SemanticVersion |
| 90 | + - Build |
| 91 | + defaults: |
| 92 | + run: |
| 93 | + shell: pwsh |
| 94 | + steps: |
| 95 | + - name: Checkout |
| 96 | + uses: actions/checkout@v3 |
| 97 | + - name: Download Artifact |
| 98 | + uses: actions/download-artifact@v4 |
| 99 | + with: |
| 100 | + name: ${{ env.ARTIFACT_NAME }} |
| 101 | + path: a/${{ env.ARTIFACT_NAME }} |
| 102 | + - uses: nuget/setup-nuget@v2 |
| 103 | + with: |
| 104 | + nuget-api-key: ${{ secrets.NUGETAPIKEY }} |
| 105 | + nuget-version: ${{ env.NUGET_VERSION }} |
| 106 | + - name: Setup Node Version |
| 107 | + uses: actions/setup-node@master |
| 108 | + with: |
| 109 | + node-version: ${{ env.NODE_VERSION }} |
| 110 | + - name: Node Package Restore |
| 111 | + run: ./build/scripts/Install-NodePackages.ps1 |
| 112 | + - name: Semantic Release |
| 113 | + id: semantic_release |
| 114 | + run: ./build/scripts/Invoke-SemanticRelease.ps1 |
| 115 | + env: |
| 116 | + GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }} |
| 117 | + GH_REF: ${{ github.ref }} |
| 118 | + - name: Publish Package |
| 119 | + run: | |
| 120 | + ./build/scripts/Publish-Package.ps1 -PackagePath "a/${{ env.ARTIFACT_NAME }}/${{ env.PACKAGE_NAME }}" |
| 121 | + env: |
| 122 | + NUGETSOURCE: ${{ vars.NUGETSOURCE }} |
0 commit comments