|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - release/*/* |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + - release/*/* |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +env: |
| 18 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 |
| 19 | + DOTNET_NOLOGO: 1 |
| 20 | + NUGET_XMLDOC_MODE: skip |
| 21 | + ARTIFACTS_DIR: artifacts |
| 22 | + |
| 23 | +# Required secrets: |
| 24 | +# SIGN_AZURE_CLIENT_ID |
| 25 | +# SIGN_AZURE_TENANT_ID |
| 26 | +# SIGN_AZURE_SUBSCRIPTION_ID |
| 27 | +# SIGN_KEY_VAULT_URL |
| 28 | +# SIGN_KEY_VAULT_CERTIFICATE_ID |
| 29 | +# UNO_NUGET_FEED_API_KEY |
| 30 | +# NUGET_ORG_API_KEY |
| 31 | + |
| 32 | +jobs: |
| 33 | + build: |
| 34 | + name: Build |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + fetch-depth: 0 |
| 41 | + |
| 42 | + - name: Determine version (NBGV) |
| 43 | + id: nbgv |
| 44 | + uses: dotnet/nbgv@f088059084cb5d872e9d1a994433ca6440c2bf72 # v0.4.2 |
| 45 | + with: |
| 46 | + toolVersion: 3.8.118 |
| 47 | + setAllVars: true |
| 48 | + |
| 49 | + - name: Export informative version |
| 50 | + shell: pwsh |
| 51 | + run: | |
| 52 | + $buildingRef = "${{ github.ref }}" |
| 53 | + $informationalVersion = "${{ steps.nbgv.outputs.SemVer2 }}+${{ steps.nbgv.outputs.GitCommitId }}-$buildingRef" -replace 'refs/heads/','' -replace '/','-' |
| 54 | + "NBGV_AssemblyInformationalVersion=$informationalVersion" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 55 | +
|
| 56 | + - name: Setup .NET |
| 57 | + uses: actions/setup-dotnet@v4 |
| 58 | + with: |
| 59 | + dotnet-version: '10.0.x' |
| 60 | + |
| 61 | + - name: Install workloads |
| 62 | + run: dotnet workload install wasm-tools wasm-tools-net9 |
| 63 | + |
| 64 | + - name: Prepare artifacts directory |
| 65 | + run: | |
| 66 | + rm -rf "$ARTIFACTS_DIR" |
| 67 | + mkdir -p "$ARTIFACTS_DIR/log" |
| 68 | +
|
| 69 | + - name: Build solution |
| 70 | + run: dotnet build MonacoEditorComponent.slnx -c Release -p:ArtifactsPath="$ARTIFACTS_DIR" /bl:"$ARTIFACTS_DIR/log/build.binlog" |
| 71 | + |
| 72 | + - name: Upload packages |
| 73 | + if: always() |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: NuGet |
| 77 | + path: artifacts/package/release |
| 78 | + if-no-files-found: warn |
| 79 | + |
| 80 | + - name: Upload logs |
| 81 | + if: always() |
| 82 | + uses: actions/upload-artifact@v4 |
| 83 | + with: |
| 84 | + name: logs |
| 85 | + path: artifacts/log |
| 86 | + if-no-files-found: warn |
| 87 | + |
| 88 | + sign: |
| 89 | + name: Sign |
| 90 | + runs-on: windows-latest |
| 91 | + needs: build |
| 92 | + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) |
| 93 | + environment: PackageSign |
| 94 | + permissions: |
| 95 | + contents: read |
| 96 | + id-token: write |
| 97 | + steps: |
| 98 | + - name: Checkout |
| 99 | + uses: actions/checkout@v4 |
| 100 | + |
| 101 | + - name: Download packages |
| 102 | + uses: actions/download-artifact@v4 |
| 103 | + with: |
| 104 | + name: NuGet |
| 105 | + path: artifacts |
| 106 | + |
| 107 | + - name: Setup .NET |
| 108 | + uses: actions/setup-dotnet@v4 |
| 109 | + with: |
| 110 | + dotnet-version: '9.0.x' |
| 111 | + |
| 112 | + - name: Install Sign CLI tool |
| 113 | + run: dotnet tool install --tool-path . sign --version 0.9.1-beta.25278.1 |
| 114 | + |
| 115 | + - name: Az CLI login |
| 116 | + uses: azure/login@v2 |
| 117 | + with: |
| 118 | + allow-no-subscriptions: true |
| 119 | + client-id: ${{ secrets.SIGN_AZURE_CLIENT_ID }} |
| 120 | + tenant-id: ${{ secrets.SIGN_AZURE_TENANT_ID }} |
| 121 | + subscription-id: ${{ secrets.SIGN_AZURE_SUBSCRIPTION_ID }} |
| 122 | + |
| 123 | + - name: Sign artifacts |
| 124 | + shell: pwsh |
| 125 | + run: >- |
| 126 | + ./sign code azure-key-vault artifacts/**/*.nupkg --publisher-name "uno.monaco-editor-uwp" |
| 127 | + --description "Uno Monaco Editor UWP" |
| 128 | + --description-url "https://github.com/${{ github.repository }}" |
| 129 | + --azure-key-vault-managed-identity true |
| 130 | + --azure-key-vault-url "${{ secrets.SIGN_KEY_VAULT_URL }}" |
| 131 | + --azure-key-vault-certificate "${{ secrets.SIGN_KEY_VAULT_CERTIFICATE_ID }}" |
| 132 | + --verbosity information |
| 133 | +
|
| 134 | + - name: Upload signed packages |
| 135 | + uses: actions/upload-artifact@v4 |
| 136 | + with: |
| 137 | + name: NuGet-Signed |
| 138 | + path: artifacts |
| 139 | + |
| 140 | + publish_dev: |
| 141 | + name: Publish Dev |
| 142 | + runs-on: ubuntu-latest |
| 143 | + needs: sign |
| 144 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 145 | + steps: |
| 146 | + - name: Checkout |
| 147 | + uses: actions/checkout@v4 |
| 148 | + |
| 149 | + - name: Uno feed publish |
| 150 | + uses: ./.github/actions/nuget-uno-publish |
| 151 | + with: |
| 152 | + token: ${{ secrets.UNO_NUGET_FEED_API_KEY }} |
| 153 | + |
| 154 | + - name: nuget.org publish |
| 155 | + uses: ./.github/actions/nuget-org-publish |
| 156 | + with: |
| 157 | + token: ${{ secrets.NUGET_ORG_API_KEY }} |
| 158 | + |
| 159 | + publish_release_uno: |
| 160 | + name: Publish Internal Feed |
| 161 | + runs-on: ubuntu-latest |
| 162 | + environment: Stable |
| 163 | + needs: sign |
| 164 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') |
| 165 | + steps: |
| 166 | + - name: Checkout |
| 167 | + uses: actions/checkout@v4 |
| 168 | + |
| 169 | + - name: Uno feed publish |
| 170 | + uses: ./.github/actions/nuget-uno-publish |
| 171 | + with: |
| 172 | + token: ${{ secrets.UNO_NUGET_FEED_API_KEY }} |
| 173 | + |
| 174 | + publish_release_nuget_org: |
| 175 | + name: Publish Production |
| 176 | + runs-on: ubuntu-latest |
| 177 | + environment: Stable |
| 178 | + needs: publish_release_uno |
| 179 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/') |
| 180 | + permissions: |
| 181 | + contents: write |
| 182 | + steps: |
| 183 | + - name: Checkout |
| 184 | + uses: actions/checkout@v4 |
| 185 | + |
| 186 | + - name: nuget.org publish |
| 187 | + uses: ./.github/actions/nuget-org-publish |
| 188 | + with: |
| 189 | + token: ${{ secrets.NUGET_ORG_API_KEY }} |
| 190 | + |
| 191 | + - name: Tag Release |
| 192 | + uses: ./.github/actions/tag-release |
0 commit comments