Skip to content

Bump actions/setup-python from 2 to 4 #209

Bump actions/setup-python from 2 to 4

Bump actions/setup-python from 2 to 4 #209

---
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@v1.3
- 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@v3
- name: checkout autopkg dev
uses: actions/checkout@v3
with:
repository: autopkg/autopkg
path: autopkg
ref: dev
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: "pip"
cache-dependency-path: |
autopkg/requirements.txt
requirements.txt
- name: Install AutoPkg Reqirements
run: pip install --requirement autopkg/requirements.txt
- name: Install requirements
run: pip install --requirement requirements.txt
- name: create empty config windows
# https://stackoverflow.com/questions/57946173/github-actions-run-step-on-specific-os
if: runner.os == 'Windows'
shell: cmd
run: |
if not exist "%USERPROFILE%/AppData/Local/Autopkg" mkdir "%USERPROFILE%/AppData/Local/Autopkg"
if not exist "%USERPROFILE%/AppData/Local/Autopkg/config.json" echo {} > "%USERPROFILE%/AppData/Local/Autopkg/config.json"
- name: create default autopkg config file Linux
if: runner.os == 'Linux'
run: |
cd ~ && mkdir -p .config/Autopkg
cd ~ && echo {} > .config/Autopkg/config.json
- 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@v3
with:
name: autopkg.msi
path: C:\Users\runneradmin\Library\AutoPkg\Cache\com.github.jgstew.msibuild.AutoPkg\autopkg.msi
if-no-files-found: warn