-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge(release/1.2.4): windows installer + vc_redist
- Loading branch information
Showing
16 changed files
with
516 additions
and
143 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.github | ||
dist | ||
node_modules | ||
venv | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- release/* | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build docker stage export | ||
run: docker buildx build --target=export --output=. . | ||
|
||
- name: Find file name with pattern monitorrent-*.zip | ||
id: find-file | ||
run: echo "release-zip=$(ls monitorrent-*.zip)" >> $GITHUB_OUTPUT | ||
|
||
- name: Upload release zip | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release | ||
path: ${{ steps.find-file.outputs.release-zip }} | ||
|
||
build-msi: | ||
name: build msi | ||
runs-on: windows-latest | ||
needs: build | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download release zip | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: release | ||
path: .artifacts | ||
|
||
- name: Find release zip in downloaded artifacts on Windows | ||
id: find-release-zip | ||
run: | | ||
"release-zip=$(ls .artifacts/monitorrent-*.zip)" >> $env:GITHUB_OUTPUT | ||
- name: Unzip release zip to dist folder | ||
run: 7z x ${{ steps.find-release-zip.outputs.release-zip }} -odist | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.8' | ||
architecture: 'x86' | ||
|
||
- name: Install python requirements | ||
run: pip install -r requirements.txt | ||
|
||
- name: Setup msbuild | ||
uses: microsoft/[email protected] | ||
with: | ||
vs-version: 17.5 | ||
|
||
- name: Setup nuget | ||
uses: nuget/setup-nuget@v1 | ||
|
||
- name: Restore solution | ||
run: | | ||
cd MonitorrentInstaller | ||
nuget restore | ||
- name: Build vs solution | ||
run: | | ||
cd MonitorrentInstaller | ||
msbuild /p:Platform="x86" /p:Configuration=Release /p:PythonLocation=$env:pythonLocation /t:Rebuild | ||
- name: Upload msi | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: installer | ||
path: MonitorrentInstaller\MonitorrentBundle\bin\Release\MonitorrentInstaller.exe |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
name: release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_description: | ||
description: 'Release description' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
createRelease: | ||
name: Merge release branch into master | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: extract version from branch name by removing release/ prefix | ||
id: extract-version | ||
run: | | ||
echo "version=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_OUTPUT | ||
- name: Fail if version is empty | ||
if: ${{ steps.extract-version.outputs.version == '' }} | ||
run: exit 1 | ||
|
||
- name: Checkout master | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: master | ||
fetch-depth: 0 | ||
|
||
- name: merge current branch into master | ||
run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
git merge --no-edit --no-ff -m "merge(release/${{ steps.extract-version.outputs.version }}): ${{ github.event.inputs.release_description }}" origin/release/${{ steps.extract-version.outputs.version }} | ||
git push origin master | ||
- name: Create tag | ||
run: | | ||
git tag ${{ steps.extract-version.outputs.version }} | ||
git push origin ${{ steps.extract-version.outputs.version }} | ||
- name: Download artifact from latest workflow run on branch | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const workflowName = 'build'; | ||
const branchName = process.env.GITHUB_REF.split('/').slice(2).join('/'); | ||
const artifactNames = ['release', 'installer']; | ||
const workflows = await github.rest.actions.listRepoWorkflows({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
// Log all workflows as json | ||
// console.log(JSON.stringify(workflows.data, null, 2)); | ||
const workflow = workflows.data.workflows.find(w => w.name === workflowName); | ||
const runs = await github.rest.actions.listWorkflowRuns({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
per_page: 1, | ||
branch: branchName, | ||
workflow_id: workflow.id, | ||
status: 'success', | ||
}); | ||
// Log all workflows as json | ||
// console.log(JSON.stringify(runs.data, null, 2)); | ||
const runId = runs.data.workflow_runs[0].id; | ||
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: runId, | ||
}); | ||
// Log all workflows as json | ||
// console.log(JSON.stringify(artifacts.data, null, 2)); | ||
const artifactIds = {}; | ||
for (const name of artifactNames) { | ||
const artifact = artifacts.data.artifacts.find(a => a.name === name); | ||
if (artifact) { | ||
artifactIds[name] = artifact.id; | ||
} else { | ||
console.log(`Artifact ${name} not found in latest workflow run.`); | ||
} | ||
} | ||
|
||
const targetDir = '.artifacts'; | ||
if (!fs.existsSync(targetDir)) { | ||
fs.mkdirSync(targetDir, { recursive: true }); | ||
} | ||
|
||
for (const [name, id] of Object.entries(artifactIds)) { | ||
const response = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: id, | ||
archive_format: 'zip', | ||
}); | ||
const filePath = path.join(targetDir, `${name}.zip`); | ||
fs.writeFileSync(filePath, Buffer.from(response.data)); | ||
} | ||
|
||
- name: Unzip .artifacts | ||
run: | | ||
unzip .artifacts/release.zip -d .artifacts | ||
unzip .artifacts/installer.zip -d .artifacts | ||
mv .artifacts/MonitorrentInstaller.exe .artifacts/MonitorrentInstaller-${{ steps.extract-version.outputs.version }}.exe | ||
rm .artifacts/release.zip | ||
rm .artifacts/installer.zip | ||
- name: Create release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: .artifacts/* | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: ${{ steps.extract-version.outputs.version }} - ${{ github.event.inputs.release_description }} | ||
tag: ${{ steps.extract-version.outputs.version }} | ||
makeLatest: true | ||
bodyFile: RELEASE_NOTES.md | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Merge into develop | ||
run: | | ||
git checkout develop | ||
git merge --no-edit --no-ff -m "merge(master): merge back" origin/master | ||
git push origin develop |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Wix xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" | ||
xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<Bundle Name="Monitorrent Installer" Version="1.2.4.100" Manufacturer="Monitorrent Team" UpgradeCode="cb50686e-6598-4da5-95bc-b36151a7f4ed"> | ||
|
||
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense"> | ||
<bal:WixStandardBootstrapperApplication | ||
LicenseFile="$(var.MonitorrentInstaller.ProjectDir)license.rtf" | ||
SuppressOptionsUI="yes" | ||
/> | ||
</BootstrapperApplicationRef> | ||
|
||
<Chain> | ||
<ExePackage Id="VCRedist" SourceFile="$(var.SolutionDir)/vcredist/vc_redist.x86.exe" InstallCommand="/q" /> | ||
<MsiPackage SourceFile="$(var.MonitorrentInstaller.TargetPath)" DisplayInternalUI="yes" > | ||
<MsiProperty Name="LICENSE_ACCEPTED" Value="1" /> | ||
</MsiPackage> | ||
</Chain> | ||
</Bundle> | ||
</Wix> |
67 changes: 67 additions & 0 deletions
67
MonitorrentInstaller/MonitorrentBundle/MonitorrentBundle.wixproj
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\packages\WiX.3.11.2\build\wix.props" Condition="Exists('..\packages\WiX.3.11.2\build\wix.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||
<ProductVersion>3.10</ProductVersion> | ||
<ProjectGuid>{20359269-a60b-4113-b8d8-c9bae586379d}</ProjectGuid> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<OutputName>MonitorrentInstaller</OutputName> | ||
<OutputType>Bundle</OutputType> | ||
<NuGetPackageImportStamp> | ||
</NuGetPackageImportStamp> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | ||
<OutputPath>bin\$(Configuration)\</OutputPath> | ||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> | ||
<DefineConstants>Debug</DefineConstants> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | ||
<OutputPath>bin\$(Configuration)\</OutputPath> | ||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="Bundle.wxs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<WixExtension Include="WixBalExtension"> | ||
<HintPath>$(WixExtDir)\WixBalExtension.dll</HintPath> | ||
<Name>WixBalExtension</Name> | ||
</WixExtension> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\MonitorrentInstaller\MonitorrentInstaller.wixproj"> | ||
<Name>MonitorrentInstaller</Name> | ||
<Project>{0f6b9fd9-b7ff-4f43-a7a5-08e00a7da154}</Project> | ||
<Private>True</Private> | ||
<DoNotHarvest>True</DoNotHarvest> | ||
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> | ||
<RefTargetDir>INSTALLFOLDER</RefTargetDir> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " /> | ||
<Target Name="DownloadVCRedist" Condition="!Exists('$(SolutionDir)/vcredist/vc_redist.x86.exe')" AfterTargets="BeforeBuild"> | ||
<!-- Download VC Redist --> | ||
<Message Text="Downloading VC Redist from https://aka.ms/vs/17/release/vc_redist.x86.exe to $(SolutionDir)/vcredist/vc_redist.x86.exe" /> | ||
<DownloadFile SourceUrl="https://aka.ms/vs/17/release/vc_redist.x86.exe" DestinationFolder="$(SolutionDir)/vcredist" /> | ||
<!-- Copy folder pythonLocation env variable to ..\env folder --> | ||
</Target> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\WiX.3.11.2\build\wix.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\WiX.3.11.2\build\wix.props'))" /> | ||
</Target> | ||
<!-- | ||
To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Wix.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="WiX" version="3.11.2" /> | ||
</packages> |
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
Oops, something went wrong.