Update version to 0.0.3 #6
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: Build and Release | |
on: | |
push: | |
branches: [ "master" ] # Updated to master | |
pull_request: | |
branches: [ "master" ] # Updated to master | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Debug, Release] | |
runs-on: windows-latest | |
env: | |
Solution_Name: DevModManager.sln | |
Test_Project_Path: DevModManager.Tests\DevModManager.Tests.csproj | |
Wap_Project_Directory: DevModManagerInstaller | |
Wap_Project_Path: DevModManagerInstaller\DevModManagerInstaller.aip | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup MSBuild.exe | |
uses: microsoft/setup-msbuild@v2 | |
- name: Increment version number | |
id: increment_version | |
run: | | |
.\scripts\increment-version.ps1 -filePath ${{ env.Wap_Project_Path }} -solutionDir . -branch master # Updated to master | |
shell: pwsh | |
- name: Commit new version | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git add ${{ env.Wap_Project_Path }} | |
git commit -m "Increment version to ${{ steps.increment_version.outputs.newVersion }}" | |
git tag v${{ steps.increment_version.outputs.newVersion }} | |
git push origin --tags | |
git push | |
shell: pwsh | |
- name: Execute unit tests | |
run: dotnet test ${{ env.Test_Project_Path }} | |
- name: Restore the application | |
run: msbuild ${{ env.Solution_Name }} /t:Restore /p:Configuration=${{ matrix.configuration }} | |
- name: Decode the pfx | |
run: | | |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") | |
$certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx | |
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | |
shell: pwsh | |
- name: Create the app package | |
run: | | |
"C:\Program Files (x86)\Caphyon\Advanced Installer 18.6\bin\x86\AdvancedInstaller.com" /build ${{ env.Wap_Project_Path }} /p:Configuration=${{ matrix.configuration }} /p:PackageCertificateKeyFile=GitHubActionsWorkflow.pfx /p:PackageCertificatePassword=${{ secrets.Pfx_Key }} | |
shell: cmd | |
- name: Remove the pfx | |
run: Remove-Item -path $env:Wap_Project_Directory\GitHubActionsWorkflow.pfx | |
shell: pwsh | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: MSI Package | |
path: ${{ env.Wap_Project_Directory }}\Release\DevModManagerInstaller.msi | |
- name: Create source zip | |
run: | | |
$version = "${{ steps.increment_version.outputs.newVersion }}" | |
$zipPath = "DevModManager.src.$version.zip" | |
Compress-Archive -Path * -DestinationPath $zipPath -Force -Exclude **\bin\*, **\obj\* | |
shell: pwsh | |
- name: Upload source zip | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Source Code | |
path: DevModManager.src.${{ steps.increment_version.outputs.newVersion }}.zip | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.increment_version.outputs.newVersion }} | |
release_name: Release ${{ steps.increment_version.outputs.newVersion }} | |
draft: false | |
prerelease: false | |
- name: Upload MSI to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ env.Wap_Project_Directory }}\Release\DevModManagerInstaller.msi | |
asset_name: DevModManagerInstaller.msi | |
asset_content_type: application/octet-stream | |
- name: Upload Source Zip to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: DevModManager.src.${{ steps.increment_version.outputs.newVersion }}.zip | |
asset_name: DevModManager.src.${{ steps.increment_version.outputs.newVersion }}.zip | |
asset_content_type: application/zip |