| 
 | 1 | +name: Build, Test and Release  | 
 | 2 | + | 
 | 3 | +on:  | 
 | 4 | +  pull_request:  | 
 | 5 | +    branches:  | 
 | 6 | +    - main  | 
 | 7 | +    types:  | 
 | 8 | +    - opened  | 
 | 9 | +    - synchronize  | 
 | 10 | +    paths-ignore:  | 
 | 11 | +    - CHANGELOG.md  | 
 | 12 | + | 
 | 13 | +  push:  | 
 | 14 | +    branches:  | 
 | 15 | +    - main  | 
 | 16 | +    paths-ignore:  | 
 | 17 | +    - CHANGELOG.md  | 
 | 18 | +    - .github/**  | 
 | 19 | +    tags: [v*]  | 
 | 20 | + | 
 | 21 | +env:  | 
 | 22 | +  buildFolderName: output  | 
 | 23 | +  buildArtifactName: output  | 
 | 24 | +  testResultFolderName: testResults  | 
 | 25 | + | 
 | 26 | +jobs:  | 
 | 27 | +  build:  | 
 | 28 | +    name: Build  | 
 | 29 | +    runs-on: ubuntu-latest  | 
 | 30 | +    steps:  | 
 | 31 | +    - name: Checkout Code  | 
 | 32 | +      uses: actions/checkout@v4  | 
 | 33 | +      with:  | 
 | 34 | +        ref: ${{ github.head_ref }}  | 
 | 35 | +        fetch-depth: 0  | 
 | 36 | + | 
 | 37 | +    - name: 'Build and Package Module'  | 
 | 38 | +      uses: ./.github/actions/build  | 
 | 39 | + | 
 | 40 | +  test-linux:  | 
 | 41 | +    name: Test on Linux  | 
 | 42 | +    runs-on: ubuntu-latest  | 
 | 43 | +    needs:  | 
 | 44 | +    - build  | 
 | 45 | +    steps:  | 
 | 46 | +    - name: Checkout Code  | 
 | 47 | +      uses: actions/checkout@v4  | 
 | 48 | +      with:  | 
 | 49 | +        ref: ${{ github.head_ref }}  | 
 | 50 | +        fetch-depth: 0  | 
 | 51 | +    - name: 'Test on Linux'  | 
 | 52 | +      uses: ./.github/actions/run-tests  | 
 | 53 | + | 
 | 54 | +  test-win:  | 
 | 55 | +    name: Test on Windows  | 
 | 56 | +    runs-on: windows-latest  | 
 | 57 | +    needs:  | 
 | 58 | +    - build  | 
 | 59 | +    steps:  | 
 | 60 | +    - name: Checkout Code  | 
 | 61 | +      uses: actions/checkout@v4  | 
 | 62 | +      with:  | 
 | 63 | +        ref: ${{ github.head_ref }}  | 
 | 64 | +        fetch-depth: 0  | 
 | 65 | +    - name: 'Test on Windows'  | 
 | 66 | +      uses: ./.github/actions/run-tests  | 
 | 67 | + | 
 | 68 | +  code-coverage:  | 
 | 69 | +    name: Publish Code Coverage  | 
 | 70 | +    if: success() || failure()  | 
 | 71 | +    runs-on: ubuntu-latest  | 
 | 72 | +    needs:  | 
 | 73 | +    - build  | 
 | 74 | +    - test-linux  | 
 | 75 | +    - test-win  | 
 | 76 | +    steps:  | 
 | 77 | +    - name: Checkout Code  | 
 | 78 | +      uses: actions/checkout@v4  | 
 | 79 | +      with:  | 
 | 80 | +        ref: ${{ github.head_ref }}  | 
 | 81 | +        fetch-depth: 0  | 
 | 82 | +    - name: 'Publish Code Coverage'  | 
 | 83 | +      uses: ./.github/actions/code-coverage  | 
 | 84 | + | 
 | 85 | +  release:  | 
 | 86 | +    if: success() && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')  | 
 | 87 | +    runs-on: ubuntu-latest  | 
 | 88 | +    needs:  | 
 | 89 | +    - build  | 
 | 90 | +    - test-linux  | 
 | 91 | +    - code-coverage  | 
 | 92 | +    steps:  | 
 | 93 | +    - name: Checkout Code  | 
 | 94 | +      uses: actions/checkout@v4  | 
 | 95 | +      with:  | 
 | 96 | +        ref: ${{ github.head_ref }}  | 
 | 97 | +        fetch-depth: 0  | 
 | 98 | +      | 
 | 99 | +    - name: Download Build Artifact  | 
 | 100 | +      uses: actions/download-artifact@v4  | 
 | 101 | +      with:  | 
 | 102 | +        name: ${{ env.buildArtifactName }}  | 
 | 103 | +        path: ${{ env.buildFolderName }}  | 
 | 104 | + | 
 | 105 | +    - name: Publish Release  | 
 | 106 | +      shell: pwsh  | 
 | 107 | +      run: Import-Module ./output/RequiredModules/PowerShellForGitHub; ./build.ps1 -tasks publish  | 
 | 108 | +      env:  | 
 | 109 | +        GitHubToken: ${{ secrets.GITHUB_TOKEN }}  | 
 | 110 | +        GalleryApiToken: ${{ secrets.BICEP_PSGALLERY_KEY }}  | 
 | 111 | + | 
 | 112 | +    - name: Send Changelog PR  | 
 | 113 | +      shell: pwsh  | 
 | 114 | +      run: Get-Module -Name PowerShellForGitHub -ListAvailable ;./build.ps1  -tasks Create_ChangeLog_GitHub_PR  | 
 | 115 | +      env:  | 
 | 116 | +        GitHubToken: ${{ secrets.GITHUB_TOKEN }}  | 
0 commit comments