Create workflow to upload msi to storage account. #17
Workflow file for this run
This file contains 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: Build and Package MSI | |
on: | |
workflow_dispatch: | |
# will delete pull request when it's ready | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_msi_installer: | |
runs-on: windows-latest | |
name: Build Windows MSI | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
- name: Install WIX Toolset | |
shell: pwsh | |
working-directory: ${{ github.workspace }}/scripts/installer/windows | |
run: | | |
Invoke-WebRequest -Uri 'https://azurecliprod.blob.core.windows.net/msi/wix310-binaries-mirror.zip' -OutFile 'wix-archive.zip' | |
Expand-Archive -Path 'wix-archive.zip' -DestinationPath 'wix' | |
Remove-Item -Path 'wix-archive.zip' | |
- name: Install Python and dependencies | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install promptflow[azure,executable] promptflow-tools | |
shell: pwsh | |
- name: Get promptflow version | |
id: get-version | |
run: | | |
$version=$(python -c "import promptflow; print(promptflow.__version__)") | |
echo "::set-output name=version::$version" | |
shell: pwsh | |
- name: Build Pyinstaller project | |
working-directory: ${{ github.workspace }}/scripts/installer/windows/scripts | |
run: | | |
echo "Version from promptflow: ${{ steps.get-version.outputs.version }}" | |
$text = Get-Content "version_info.txt" -Raw | |
$text = $text -replace '\$\((env\.CLI_VERSION)\)', '${{ steps.get-version.outputs.version }}' | |
$text | Out-File -FilePath "version_info.txt" -Encoding utf8 | |
pyinstaller promptflow.spec | |
shell: pwsh | |
- name: Build WIX project | |
working-directory: ${{ github.workspace }}/scripts/installer/windows | |
run: | | |
$text = Get-Content "promptflow.wixproj" -Raw | |
$text = $text -replace '\$\((env\.CLI_VERSION)\)', '${{ steps.get-version.outputs.version }}' | |
$text | Out-File -FilePath "promptflow.wixproj" -Encoding utf8 | |
$text = Get-Content "product.wxs" -Raw | |
$text = $text -replace '\$\((env\.CLI_VERSION)\)', '${{ steps.get-version.outputs.version }}' | |
$text | Out-File -FilePath "product.wxs" -Encoding utf8 | |
msbuild /t:rebuild /p:Configuration=Release /p:Platform=x64 promptflow.wixproj | |
shell: pwsh | |
- name: Upload MSI to Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: msi-artifact | |
path: scripts/installer/windows/out/*.msi | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Upload to Azure Storage | |
env: | |
AZURE_STORAGE_ACCOUNT_NAME: promptflowartifact | |
AZURE_CONTAINER_NAME: msi-installer | |
run: | | |
az storage blob upload \ | |
--account-name $AZURE_STORAGE_ACCOUNT_NAME \ | |
--container-name $AZURE_CONTAINER_NAME \ | |
--file scripts/installer/windows/out/*.msi \ | |
--name chenyin_test |