Skip to content

Bump microsoft/setup-msbuild from 1.3 to 2 #226

Bump microsoft/setup-msbuild from 1.3 to 2

Bump microsoft/setup-msbuild from 1.3 to 2 #226

---
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