Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add msix templates and create package job #305

Merged
merged 23 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 78 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ jobs:
- name: Run jinja2
run: python packaging/replace.py $VERSION

- run: cp LICENSE replaced

- run: cp packaging/windows/*.ico replaced
- run: cp packaging/linux/icon.svg replaced
- name: Copy icons and license
run: |
cp LICENSE replaced
cp packaging/windows/*.ico replaced
cp packaging/windows/*.png replaced
cp packaging/linux/icon.svg replaced

- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -271,7 +273,75 @@ jobs:
name: ${{ format('package-{0}', matrix.os) }}
path: dist/*.dmg

gh-release:
package-windows-msix:
needs: [ pyinstaller, version, package-prep ]
runs-on: windows-latest
env:
VERSION: ${{ needs.version.outputs.code }}
KIT_PATH: 'C:\Program Files (x86)\Windows Kits\10\App Certification Kit'
steps:
- uses: actions/download-artifact@v4
with:
name: packaging
path: packaging

- uses: actions/download-artifact@v4
with:
name: build-windows-latest

- run: tar -xvf build.tar

- name: Add App Certification Kit to path
run: echo $env:KIT_PATH >> $env:GITHUB_PATH

- name: Build .msix package
run: MakeAppx.exe build /f PackagingLayout.xml /op ..
working-directory: packaging

- name: Compress .msixbundle
run: >
Compress-Archive
-Path *.msixbundle
-DestinationPath msixupload.zip

- name: Rename .zip file to .msixupload
run: >
Move-Item
-Path msixupload.zip
-Destination app.bbsync.BlackboardSync.msixupload

- uses: actions/upload-artifact@v4
with:
name: package-msixupload
path: '*.msixupload'

deploy-msstore:
runs-on: windows-latest
needs: [ package-windows-msix ]
if: ${{ false }}
steps:
- uses: actions/download-artifact@v4
with:
name: package-msixupload

- name: Setup Microsoft Store Developer CLI
uses: microsoft/setup-msstore-cli@v1

- name: Configure Microsoft Store Developer CLI
run: >
msstore reconfigure
--tenantId ${{ secrets.MS_TENANT_ID }}
--sellerId ${{ secrets.MS_SELLER_ID }}
--clientId ${{ secrets.MS_CLIENT_ID }}
--clientSecret ${{ secrets.MS_CLIENT_KEY }}

- name: Publish package in Microsoft Store
run: >
msstore publish app.bbsync.BlackboardSync.msixupload
--appId ${{ secrets.MS_APP_ID }}
--noCommit -v

deploy-github:
if: startsWith(github.ref, 'refs/tags/')
needs: [ package-windows, package-macos, release-notes ]
runs-on: ubuntu-latest
Expand All @@ -282,16 +352,16 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
path: ./dist
pattern: package-*
merge-multiple: true

- uses: softprops/action-gh-release@v1
with:
body: ${{ env.RELEASE_NOTES }}
prerelease: ${{ env.PRE_RELEASE }}
files: |
dist/*.exe
dist/*.dmg
'*.exe'
'*.dmg'

pr-comment:
if: ${{ github.event_name == 'pull_request' }}
Expand Down
12 changes: 12 additions & 0 deletions packaging/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
sys.path.insert(0, os.path.abspath('.'))

from typing import Any
from packaging.version import Version

from jinja2 import Environment, select_autoescape
from jinja2 import FileSystemLoader
Expand All @@ -24,6 +25,11 @@
from releases import get_releases


def get_version_base(version: str) -> str:
v = Version(version)
return v.base_version


def replace_templates(template_files, context, outdir) -> int:
folders = ["packaging/windows", "packaging/macos", "packaging/linux"]

Expand All @@ -43,8 +49,13 @@ def replace_templates(template_files, context, outdir) -> int:

def main(argv: list[str]) -> int:
__version__ = argv[1]
__version_base__ = get_version_base(__version__)

template_files = [
# Windows (MSIX)
"AppXManifest.xml",
"PackagingLayout.xml",

# Windows
"pkg_win.nsi",

Expand All @@ -60,6 +71,7 @@ def main(argv: list[str]) -> int:
'package': __id__,
'title':__title__,
'version':__version__,
'version_base': __version_base__,
'author':__author__,
'summary':__summary__,
'homepage':__homepage__,
Expand Down
50 changes: 50 additions & 0 deletions packaging/windows/AppXManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">

<Identity Name="{{ publisher }}.27984CD41C10"
Version="{{ version_base }}.0"
Publisher="CN=08B29936-C25A-4550-B7B9-EF5FF06CAC8A"
ProcessorArchitecture="x64" />

<Properties>
<DisplayName>{{ title }}</DisplayName>
<PublisherDisplayName>{{ publisher }}</PublisherDisplayName>
<Description>{{ summary }}</Description>
<Logo>Icons\icon-150.png</Logo>
</Properties>

<Resources>
<Resource Language="en-us" />
</Resources>

<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop"
MinVersion="10.0.17763.0"
MaxVersionTested="10.0.26100.0" />
</Dependencies>

<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>

<Applications>
<Application Id="{{ package }}"
Executable="BlackboardSync.exe"
EntryPoint="Windows.FullTrustApplication"
uap10:RuntimeBehavior="packagedClassicApp"
uap10:TrustLevel="mediumIL">

<uap:VisualElements
DisplayName="{{ title }}"
Description="{{ summary }}"
Square150x150Logo="Icons\icon-150.png"
Square44x44Logo="Icons\icon-44.png"
BackgroundColor="transparent" />
</Application>
</Applications>
</Package>
13 changes: 13 additions & 0 deletions packaging/windows/PackagingLayout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<PackagingLayout xmlns="http://schemas.microsoft.com/appx/makeappx/2017">
<PackageFamily ID="{{ package }}" FlatBundle="false"
ManifestPath="AppXManifest.xml" ResourceManager="false">

<Package ID="x64" ProcessorArchitecture="x64">
<Files>
<File DestinationPath="**" SourcePath="..\dist\BlackboardSync\**"/>
<File DestinationPath="Icons\*.png" SourcePath="*.png"/>
</Files>
</Package>

</PackageFamily>
</PackagingLayout>