Skip to content
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @buildalon/buildalon
101 changes: 101 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: validate
on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unity-build:
name: '(${{ matrix.unity-version }}) ${{ matrix.build-target }} - ${{ matrix.uwp-package-type }}'
env:
TEMPLATE_PATH: ''
UNITY_PROJECT_PATH: '' # set by unity-setup action
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
build-target: [WSAPlayer]
unity-version: [2021.x, 2022.x, 6000.x]
uwp-package-type: [sideload, upload]
steps:
- uses: actions/checkout@v4
- run: 'npm install -g openupm-cli'
# Installs the Unity Editor based on your project version text file
# sets -> env.UNITY_EDITOR_PATH
# sets -> env.UNITY_PROJECT_PATH
- uses: buildalon/unity-setup@v1
with:
version-file: 'None'
build-targets: ${{ matrix.build-target }}
unity-version: ${{ matrix.unity-version }}
- name: Find Unity Template Path
run: |
$rootPath = $env:UNITY_EDITOR_PATH -replace "Editor.*", ""
Write-Host "ROOT_PATH=$rootPath"
$templatePath = Get-ChildItem -Recurse -Filter "com.unity.template.3d*.tgz" -Path $rootPath | Select-Object -First 1 | Select-Object -ExpandProperty FullName
Write-Host "TEMPLATE_PATH=$templatePath"
echo "TEMPLATE_PATH=$templatePath" >> $env:GITHUB_ENV
$projectPath = "${{ github.workspace }}/TestProject"
echo "UNITY_PROJECT_PATH=$projectPath" >> $env:GITHUB_ENV
shell: pwsh
# Activates the installation with the provided credentials
- uses: buildalon/activate-unity-license@v1
with:
license: 'Personal'
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
- uses: buildalon/unity-action@v1
name: Create Test Project
with:
log-name: 'create-test-project'
args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/TestProject" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"'
- run: 'openupm add com.virtualmaker.buildalon'
name: Add Build Pipeline Package
working-directory: ${{ github.workspace }}/TestProject
- uses: buildalon/unity-action@v1
name: '${{ matrix.build-target }}-Validate'
with:
build-target: ${{ matrix.build-target }}
log-name: '${{ matrix.build-target }}-Validate'
args: '-quit -nographics -batchmode -executeMethod Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset'
- uses: buildalon/unity-action@v1
name: '${{ matrix.build-target }}-Build'
with:
build-target: ${{ matrix.build-target }}
log-name: '${{ matrix.build-target }}-Build'
args: '-quit -nographics -batchmode -executeMethod Buildalon.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity -arch ARM64'

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- uses: microsoft/setup-msbuild@v2

# builds visual studio project for UWP and packages it as an appx
- uses: ./ # buildalon/unity-uwp-builder
id: uwp-build
with:
project-path: ${{ env.UNITY_PROJECT_PATH }}/Builds/WSAPlayer
package-type: ${{ matrix.uwp-package-type }}

- name: print outputs
shell: bash
run: |
echo "Executable: ${{ steps.uwp-build.outputs.executable }}"
echo "Output Directory: ${{ steps.uwp-build.outputs.output-directory }}"
ls -R "${{ steps.uwp-build.outputs.output-directory }}"

- uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ${{ github.run_number }}.${{ github.run_attempt }} ${{ matrix.unity-version }}-${{ matrix.build-target }}-${{ matrix.uwp-package-type }}
path: |
${{ github.workspace }}/**/*.log
${{ steps.uwp-build.outputs.output-directory }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Buildalon: Automate Unity
Copyright (c) 2024 Virtual Maker Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# unity-uwp-builder
# Buildalon unity-uwp-builder

A GitHub Action to build Unity exported UWP projects.

> [!NOTE]
> The main goal of this action to to take what is provided from Unity and package it to be directly uploaded to the Microsoft Store.

## How to use

### workflow

```yaml
steps:
# required for unity-uwp-builder action
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'
- uses: microsoft/setup-msbuild@v2

- uses: buildalon/unity-uwp-builder@v1
id: uwp-build
with:
project-path: '/path/to/your/build/output/directory'
package-type: 'upload'

- name: print outputs
shell: bash
run: |
echo "Executable: ${{ steps.uwp-build.outputs.executable }}"
echo "Output Directory: ${{ steps.uwp-build.outputs.output-directory }}"
ls -R "${{ steps.uwp-build.outputs.output-directory }}"
```

### inputs

| name | description | required |
| ---- | ----------- | -------- |
| `project-path` | The directory that contains the exported visual studio project from Unity. | true |
| `configuration` | The configuration to use when building the visual studio project. | Defaults to `Master`. |
| `architecture` | The architecture to use when building the visual studio project. Can be: `x86`, `x64`, `ARM`, or `ARM64`. | Defaults to `ARM64`. |
| `package-type` | The type of package to generate. Can be: `sideload` or `upload`. | Defaults to `sideload`. |
| `certificate-path` | The path to the certificate to use when packaging the UWP project. | Required when `package-type` is `sideload`. If no certificate is provided, then a self signed test certificate is created. |

### outputs

- `executable`: The path to the generated appx executable.
- `export-path`: The path to the export directory.
35 changes: 35 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Buildalon unity-uwp-builder
description: A GitHub Action to build Unity exported UWP projects.
branding:
icon: package
color: red
inputs:
project-path:
description: The directory that contains the exported visual studio project from Unity.
required: true
configuration:
description: The configuration to use when building the visual studio project. Defaults to `Master`.
required: false
default: 'Master'
architecture:
description: 'The architecture to use when building the visual studio project. Can be: `x86`, `x64`, `ARM`, or `ARM64`.'
required: false
default: 'ARM64'
additional-args:
description: Additional arguments to pass to the msbuild command.
required: false
package-type:
description: 'The type of package to generate. Can be: `sideload` or `upload`. Defaults to `sideload`.'
required: false
default: 'sideload'
certificate-path:
description: 'The path to the certificate to use when packaging the UWP project. Required when `package-type` is `sideload`. If no certificate is provided, then a test certificate is created.'
required: false
outputs:
executable:
description: The path to the generated executable.
output-directory:
description: The path to the output-directory.
runs:
using: 'node20'
main: 'dist/index.js'
Loading
Loading