Publish CodeQL Pack #6
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: Publish CodeQL Pack | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| codeql-version: | |
| description: 'CodeQL version to use' | |
| required: true | |
| type: string | |
| release-type: | |
| description: 'Publish with pre-release version' | |
| required: false | |
| type: string | |
| jobs: | |
| publish: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Enable long git paths | |
| shell: cmd | |
| run: git config --global core.longpaths true | |
| - name: Clone self (windows-driver-developer-supplemental-tools) | |
| uses: actions/checkout@v4 | |
| with: | |
| path: . | |
| fetch-depth: 0 | |
| - name: CodeQL Download | |
| run: | |
| Invoke-WebRequest -Uri "https://github.com/github/codeql-cli-binaries/releases/download/v${{ github.event.inputs.codeql-version }}/codeql-win64.zip" -OutFile codeql-win64.zip; | |
| Expand-Archive -Path codeql-win64.zip -DestinationPath .\codeql-zip -Force; | |
| Move-Item -Path .\codeql-zip\codeql -Destination .\codeql-cli\ | |
| - name: Install CodeQL pack dependencies | |
| shell: cmd | |
| run: | | |
| pushd .\src | |
| ..\codeql-cli\codeql.cmd pack install | |
| popd | |
| - name: Publish New CodeQL Pack | |
| shell: pwsh | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if ("${{ github.event.inputs.release-type }}" -ne "") { | |
| $version =( Select-String .\src\qlpack.yml -Pattern "version").line; | |
| $new_ver = "$version-${{ github.event.inputs.release-type }}"; | |
| (Get-Content .\src\qlpack.yml).Replace($version, $new_ver) | Set-Content .\src\qlpack.yml; | |
| .\codeql-cli\codeql.cmd pack publish --allow-prerelease ./src; | |
| } else { | |
| .\codeql-cli\codeql.cmd pack publish ./src | |
| } |