Bump microsoft/setup-msbuild from 1.3 to 2 #227
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: Test AutoPkg Release MSI | |
# based upon: https://github.com/cli/cli/blob/c4455297198031b8701544f5fff1b2621e57c454/.github/workflows/releases.yml#L130-L157 | |
# https://github.com/microsoft/setup-msbuild | |
# Uses the following: | |
# - https://github.com/jgstew/jgstew-recipes/blob/main/.templates/projectname.wixproj.mustache | |
# - https://github.com/jgstew/jgstew-recipes/blob/main/.templates/projectname.wxs.mustache | |
# - https://github.com/jgstew/jgstew-recipes/blob/main/_Shared/ui.wxs | |
# - https://github.com/jgstew/jgstew-recipes/blob/main/AutoPkgRecipe/AutoPkgRelease.msbuild.recipe.yaml | |
on: | |
push: | |
paths: | |
- ".github/workflows/AutoPkgReleaseMSI.yaml" | |
- "AutoPkgRecipe/AutoPkgReleaseSource.download.recipe.yaml" | |
- "AutoPkgRecipe/AutoPkgRelease.msbuild.recipe.yaml" | |
- "_Shared/ui.wxs" | |
- ".templates/projectname.wxs.mustache" | |
- ".templates/projectname.wixproj.mustache" | |
pull_request: | |
paths: | |
- ".github/workflows/AutoPkgReleaseMSI.yaml" | |
- "AutoPkgRecipe/AutoPkgReleaseSource.download.recipe.yaml" | |
- "AutoPkgRecipe/AutoPkgRelease.msbuild.recipe.yaml" | |
- "_Shared/ui.wxs" | |
- ".templates/projectname.wxs.mustache" | |
- ".templates/projectname.wixproj.mustache" | |
jobs: | |
AutoPkgMSI: | |
runs-on: windows-latest | |
steps: | |
# only needed on self hosted windows runners: | |
- name: set powershell execution policy CurrentUser | |
if: runner.os == 'Windows' | |
shell: cmd | |
run: powershell -command "Set-ExecutionPolicy -Force -ExecutionPolicy RemoteSigned -Scope CurrentUser" | |
- name: Add msbuild to PATH | |
# https://github.com/microsoft/setup-msbuild | |
if: runner.os == 'Windows' | |
uses: microsoft/setup-msbuild@v2 | |
- name: Set token | |
# required for githubreleaseinfoprovider in github actions | |
# without this, API limits will be hit | |
run: | | |
cd ~ | |
echo ${{ secrets.GITHUB_TOKEN }} > ".autopkg_gh_token" | |
- name: checkout this repo | |
uses: actions/checkout@v4 | |
- name: setup-autopkg local action | |
uses: ./.github/actions/setup-autopkg | |
- name: Install requirements | |
run: pip install --requirement requirements.txt | |
- name: run test recipe autopkg | |
run: python autopkg/Code/autopkg run -v Test-Recipes/AutopkgCore.test.recipe.yaml | |
- name: run msibuild recipe | |
run: python autopkg/Code/autopkg run -vv AutoPkgRecipe/AutoPkgRelease.msbuild.recipe.yaml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: run msbuild | |
if: runner.os == 'Windows' | |
shell: bash | |
env: | |
ZIP_FILE: C:\Users\runneradmin\Library\AutoPkg\Cache\com.github.jgstew.msibuild.AutoPkg\downloads\autopkg.zip | |
MSBUILD_PATH: ${{ steps.setupmsbuild.outputs.msbuildPath }} | |
# TODO: get version from autopkg recipe output | |
# TODO: get MSBuild path from above step | |
run: | | |
cd ~ | |
pwd | |
cd Library/AutoPkg/Cache/com.github.jgstew.msibuild.AutoPkg | |
pwd | |
cd "/c/Program Files/Microsoft Visual Studio/2022/Enterprise" | |
pwd | |
cat ~/Library/AutoPkg/Cache/com.github.jgstew.msibuild.AutoPkg/autopkg.wixproj | |
name="$(basename "$ZIP_FILE" ".zip")" | |
version="2.4.1" | |
"MSBuild.exe" ~/Library/AutoPkg/Cache/com.github.jgstew.msibuild.AutoPkg/autopkg.wixproj -p:SourceDir="$GITHUB_WORKSPACE/autopkg/Code" -p:OutputPath="." -p:OutputName="$name" -p:ProductVersion="$version" | |
- name: upload built MSI | |
if: runner.os == 'Windows' | |
# https://github.com/actions/upload-artifact | |
# TODO: get artifact path dynamically | |
uses: actions/upload-artifact@v4 | |
with: | |
name: autopkg.msi | |
path: C:\Users\runneradmin\Library\AutoPkg\Cache\com.github.jgstew.msibuild.AutoPkg\autopkg.msi | |
if-no-files-found: warn |