Skip to content

Build

Build #13

Workflow file for this run

name: Build
on:
workflow_dispatch:
inputs:
do-deploy:
type: boolean
description: create release?
version:
required: true
description: Version number (e.g. 1.5)
env:
AppName: DFTContextMenuHandler
# prefix version number with e.g. "v" or nothing
VersionNumberPrefix: v
jobs:
build:
runs-on: windows-latest
env:
ScriptsPath: .\.github\workflows
SolutionPath: src\CmdLineExt.sln
OutputPath: src/bin/x64/Unicode Release
VersionNumber: ${{ github.event.inputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
if: github.event.inputs.do-deploy == 'true'
uses: actions/setup-python@v2
with:
python-version: '3.9.13'
- name: Install Python module
if: github.event.inputs.do-deploy == 'true'
run: |
python -m pip install --upgrade pip
#linux: pip3 install gh-md-to-html
python3 -m pip install gh-md-to-html
- name: Convert md file
if: github.event.inputs.do-deploy == 'true'
run: |
mkdir temp
copy .\README.md temp
cd temp
#linux: gh-md-to-html README.md -c "" -w . --math false --box-width 24.25cm
python3 -m gh_md_to_html README.md -c "" -w . --math false --box-width 24.25cm
move .\README.html ..
move .\images\ ..
cd ..
Remove-Item -LiteralPath "temp" -Force -Recurse
- name: Delete components
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToRemove= @(
"Microsoft.VisualStudio.Component.VC.ATL"
)
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
- name: Install components
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToRemove= @(
"Microsoft.VisualStudio.Component.VC.v141.ATL"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL"
)
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --add " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Build
run: |
msbuild ${{ env.SolutionPath }} /p:Configuration="Unicode_Release" /p:Platform="x64"
msbuild src/SlideShow/SlideShow.sln /p:Configuration="Release" /p:Platform="Any CPU"
#- name: list
# run: |
# Get-ChildItem -Path $env:GITHUB_WORKSPACE -Recurse
- name: Clean
run: |
Remove-Item -Recurse -Force ".github"
Remove-Item -Recurse -Force ".git"
Remove-Item -Force ".gitignore"
Remove-Item -Recurse -Force "src\x64"
Get-Childitem -Include obj -Recurse -Force | Remove-Item -Force -Recurse
Get-Childitem * -Include ('*.pdb', '*.xml') -Recurse | Remove-Item
#- name: Upload Artifact
# uses: actions/upload-artifact@v2
# with:
# name: ${{ env.AppName }}-${{ env.VersionNumberPrefix }}${{ env.VersionNumber }}
# path: ${{ github.workspace }}
# include deploy job as conditional steps
#deploy:
# needs: [build]
# if: github.event.inputs.do-deploy == 'true'
# strategy:
# matrix:
# configuration: [Release]
#
# runs-on: windows-latest
#
# env:
# VersionNumber: ${{ github.event.inputs.version }}
#
# steps:
- name: Create Draft Release
id: create_release
if: github.event.inputs.do-deploy == 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VersionNumberPrefix }}${{ env.VersionNumber }}
release_name: ${{ env.AppName }}-${{ env.VersionNumberPrefix }}${{ env.VersionNumber }}
draft: true
prerelease: false
#- name: Download artifacts
# uses: actions/download-artifact@v2
# with:
# name: ${{ env.AppName }}-${{ env.VersionNumberPrefix }}${{ env.VersionNumber }}
# path: ${{ env.AppName }}
- name: Zip files
if: github.event.inputs.do-deploy == 'true'
uses: thedoctor0/zip-release@master
with:
type: 'zip'
filename: '${{ env.AppName }}-${{ env.VersionNumberPrefix }}${{ env.VersionNumber }}.zip'
#path: ${{ env.AppName }}
path: ${{ github.workspace }}
- name: Upload release assets
if: github.event.inputs.do-deploy == 'true'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .\${{ env.AppName }}-${{ env.VersionNumberPrefix }}${{ env.VersionNumber }}.zip
asset_name: ${{ env.AppName }}-${{ env.VersionNumberPrefix }}${{ env.VersionNumber }}.zip
asset_content_type: application/zip