Create New Version #3
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: Create New Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
type: choice | |
default: "Patch" | |
description: Select next release type | |
options: | |
- Patch | |
- Minor | |
- Major | |
required: true | |
pre-release: | |
type: boolean | |
description: Set as Pre-release version | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Create Release Asset | |
runs-on: ubuntu-latest | |
outputs: | |
Build_Version: ${{ steps.versioning.outputs.version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Auto Increment Semver Action | |
uses: MCKanpolat/[email protected] | |
id: versioning | |
with: | |
releaseType: ${{ github.event.inputs.version }} | |
incrementPerCommit: false | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update Powershell Version | |
#Replace line 12 with new version | |
run: sed -i '12s/.*/$Script:WingetIntunePackager = "${{ steps.versioning.outputs.version }}"/g' sources/WingetIntunePackager.ps1 | |
- name: Commit & Push | |
uses: actions-js/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
force: true | |
message: "Changed version to ${{ steps.versioning.outputs.version }}" | |
Packaging: | |
runs-on: windows-latest | |
needs: [build] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} #needed to get latest commit | |
- name: Compile EXE | |
env: | |
Version: ${{needs.build.outputs.Build_Version}} | |
shell: powershell | |
working-directory: . | |
run: | | |
"Setting Version Number" | |
[String]$Version="$env:Version" | |
"Version is $Version" | |
"Installing Module PS2EXE" | |
Install-Module -Name ps2exe -force | |
"Impoting Module PS2EXE" | |
Import-Module -Name ps2exe | |
"Setting App Info" | |
$Input = ".\sources\WingetIntunePackager.ps1" | |
$Output = ".\WingetIntunePackager.exe" | |
$Icon = ".\sources\WingetIntunePackager.ico" | |
$Title = "Winget Intune Packager" | |
$Description = "Intune Winget app packager" | |
"Creating EXE" | |
Invoke-PS2EXE -inputFile $Input -outputFile $Output -iconFile $Icon -product $Title -version $Version -title $Description -copyright 'Romanitho' -noConsole -noerror -Verbose -ErrorAction Stop | |
- name: Create release | |
uses: "ncipollo/[email protected]" | |
with: | |
tag: "v${{needs.build.outputs.Build_Version}}" | |
prerelease: ${{ github.event.inputs.pre-release }} | |
generateReleaseNotes: true | |
name: "v${{needs.build.outputs.Build_Version}}" | |
artifacts: WingetIntunePackager.exe |