-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add PupNet-Deploy files * Add release and build workflows * Add Compile Constants
- Loading branch information
Showing
7 changed files
with
584 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Build Linux (PupNet) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
AppVersion: | ||
type: string | ||
required: false | ||
description: "The version of the application to build" | ||
default: "1.0.0" | ||
PupNetVersion: | ||
type: string | ||
required: false | ||
description: "The PupNet version to use" | ||
default: "1.6.0" | ||
ProjectFile: | ||
type: string | ||
required: true | ||
description: "The relative path to the project to build" | ||
RetentionDays: | ||
type: number | ||
required: false | ||
default: 1 | ||
description: "The amount of days for the artifact to persist" | ||
BuildAppImage: | ||
type: boolean | ||
description: "Build an AppImage?" | ||
required: false | ||
default: true | ||
BuildArchive: | ||
type: boolean | ||
description: "Build an Archive?" | ||
required: false | ||
default: true | ||
outputs: | ||
ArtifactNameLinuxArchive: | ||
description: "Name of the Artifact that contains the Linux Archive" | ||
value: ${{ jobs.build.outputs.artifactNameLinuxArchive }} | ||
ArtifactNameLinuxAppImage: | ||
description: "Name of the Artifact that contains the Linux AppImage" | ||
value: ${{ jobs.build.outputs.artifactNameLinuxAppImage }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
artifactNameLinuxArchive: ${{ steps.setOutputs.outputs.artifactNameLinuxArchive }} | ||
artifactNameLinuxAppImage: ${{ steps.setOutputs.outputs.artifactNameLinuxAppImage }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: Transform inputs | ||
id: transformInputs | ||
shell: pwsh | ||
env: | ||
ProjectFile: ${{ inputs.ProjectFile }} | ||
run: | | ||
$projectDir = [System.IO.Path]::GetDirectoryName("$env:ProjectFile") | ||
$projectName = [System.IO.Path]::GetFileNameWithoutExtension("$env:ProjectFile") | ||
echo "projectDir=$projectDir" >> $env:GITHUB_OUTPUT | ||
echo "projectName=$projectName" >> $env:GITHUB_OUTPUT | ||
- name: Print debug info | ||
run: dotnet --info | ||
|
||
# https://github.com/AppImage/AppImageKit/wiki/FUSE#install-fuse | ||
- name: Install FUSE | ||
run: sudo add-apt-repository universe && sudo apt install libfuse2 | ||
|
||
- name: Get PupNet | ||
run: dotnet tool install -g KuiperZone.PupNet --version ${{ inputs.PupNetVersion }} | ||
|
||
- name: Create Archive | ||
if: ${{ inputs.BuildArchive }} | ||
working-directory: ${{ steps.transformInputs.outputs.projectDir }} | ||
run: pupnet -y -v ${{ inputs.AppVersion }} -k zip -p DefineConstants=INSTALLATION_METHOD_ARCHIVE | ||
|
||
- name: Create AppImage | ||
if: ${{ inputs.BuildAppImage }} | ||
working-directory: ${{ steps.transformInputs.outputs.projectDir }} | ||
run: pupnet -y -v ${{ inputs.AppVersion }} -k AppImage -p DefineConstants=INSTALLATION_METHOD_APPIMAGE | ||
|
||
- name: Set outputs | ||
id: setOutputs | ||
shell: pwsh | ||
run: | | ||
echo "artifactNameLinuxArchive=${{ steps.transformInputs.outputs.projectName }}-${{ github.sha }}-Linux-Archive" >> $env:GITHUB_OUTPUT | ||
echo "artifactNameLinuxAppImage=${{ steps.transformInputs.outputs.projectName }}-${{ github.sha }}-Linux-AppImage" >> $env:GITHUB_OUTPUT | ||
- name: Upload Archive | ||
if: ${{ inputs.BuildArchive }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.setOutputs.outputs.artifactNameLinuxArchive }} | ||
path: ${{ steps.transformInputs.outputs.projectDir }}/Deploy/OUT/*.zip | ||
if-no-files-found: error | ||
retention-days: ${{ inputs.RetentionDays }} | ||
|
||
- name: Upload AppImage | ||
if: ${{ inputs.BuildAppImage }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.setOutputs.outputs.artifactNameLinuxAppImage }} | ||
path: ${{ steps.transformInputs.outputs.projectDir }}/Deploy/OUT/*.AppImage | ||
if-no-files-found: error | ||
retention-days: ${{ inputs.RetentionDays }} |
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,105 @@ | ||
name: Build Windows (PupNet) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
AppVersion: | ||
type: string | ||
required: false | ||
description: "The version of the application to build" | ||
default: "1.0.0" | ||
PupNetVersion: | ||
type: string | ||
required: false | ||
description: "The PupNet version to use" | ||
default: "1.6.0" | ||
ProjectFile: | ||
type: string | ||
required: true | ||
description: "The relative path to the project to build" | ||
RetentionDays: | ||
type: number | ||
required: false | ||
default: 1 | ||
description: "The amount of days for the artifact to persist" | ||
BuildInnoSetup: | ||
type: boolean | ||
description: "Build an Inno Setup?" | ||
required: false | ||
default: true | ||
BuildArchive: | ||
type: boolean | ||
description: "Build an Archive?" | ||
required: false | ||
default: true | ||
outputs: | ||
ArtifactNameWindowsArchive: | ||
description: "Name of the Artifact that contains the Windows Archive" | ||
value: ${{ jobs.build.outputs.artifactNameWindowsArchive }} | ||
ArtifactNameWindowsInnoSetup: | ||
description: "Name of the Artifact that contains the Windows Inno Setup" | ||
value: ${{ jobs.build.outputs.artifactNameWindowsInnoSetup }} | ||
|
||
jobs: | ||
build: | ||
runs-on: windows-latest | ||
outputs: | ||
artifactNameWindowsArchive: ${{ steps.setOutputs.outputs.artifactNameWindowsArchive }} | ||
artifactNameWindowsInnoSetup: ${{ steps.setOutputs.outputs.artifactNameWindowsInnoSetup }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: "recursive" | ||
|
||
- name: Transform inputs | ||
id: transformInputs | ||
shell: pwsh | ||
env: | ||
ProjectFile: ${{ inputs.ProjectFile }} | ||
run: | | ||
$projectDir = [System.IO.Path]::GetDirectoryName("$env:ProjectFile") | ||
$projectName = [System.IO.Path]::GetFileNameWithoutExtension("$env:ProjectFile") | ||
echo "projectDir=$projectDir" >> $env:GITHUB_OUTPUT | ||
echo "projectName=$projectName" >> $env:GITHUB_OUTPUT | ||
- name: Print debug info | ||
run: dotnet --info | ||
|
||
- name: Get PupNet | ||
run: dotnet tool install -g KuiperZone.PupNet --version ${{ inputs.PupNetVersion }} | ||
|
||
- name: Create Archive | ||
if: ${{ inputs.BuildArchive }} | ||
working-directory: ${{ steps.transformInputs.outputs.projectDir }} | ||
run: pupnet -y -v ${{ inputs.AppVersion }} -k zip -p DefineConstants=INSTALLATION_METHOD_ARCHIVE | ||
|
||
- name: Create Setup | ||
if: ${{ inputs.BuildInnoSetup }} | ||
working-directory: ${{ steps.transformInputs.outputs.projectDir }} | ||
run: pupnet -y -v ${{ inputs.AppVersion }} -k Setup -p DefineConstants=INSTALLATION_METHOD_INNO_SETUP | ||
|
||
- name: Set outputs | ||
id: setOutputs | ||
shell: pwsh | ||
run: | | ||
echo "artifactNameWindowsArchive=${{ steps.transformInputs.outputs.projectName }}-${{ github.sha }}-Windows-Archive" >> $env:GITHUB_OUTPUT | ||
echo "artifactNameWindowsInnoSetup=${{ steps.transformInputs.outputs.projectName }}-${{ github.sha }}-Windows-Setup" >> $env:GITHUB_OUTPUT | ||
- name: Upload Archive | ||
if: ${{ inputs.BuildArchive }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.setOutputs.outputs.artifactNameWindowsArchive }} | ||
path: ${{ steps.transformInputs.outputs.projectDir }}/Deploy/OUT/*.zip | ||
if-no-files-found: error | ||
retention-days: ${{ inputs.RetentionDays }} | ||
|
||
- name: Upload Setup | ||
if: ${{ inputs.BuildInnoSetup }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.setOutputs.outputs.artifactNameWindowsInnoSetup }} | ||
path: ${{ steps.transformInputs.outputs.projectDir }}/Deploy/OUT/*.exe | ||
if-no-files-found: error | ||
retention-days: ${{ inputs.RetentionDays }} |
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,162 @@ | ||
name: Release | ||
run-name: Release ${{ inputs.version }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "The version to release (eg: 'v1.0.0')" | ||
required: true | ||
type: string | ||
draft: | ||
description: "Create a draft release?" | ||
required: false | ||
type: boolean | ||
default: true | ||
prerelease: | ||
description: "Create a prerelease?" | ||
required: false | ||
type: boolean | ||
default: true | ||
release-nexus-mods: | ||
description: "Release on Nexus Mods?" | ||
required: false | ||
type: boolean | ||
default: false | ||
notify-discord: | ||
description: "Notify on Discord?" | ||
required: false | ||
type: boolean | ||
default: false | ||
notify-slack: | ||
description: "Notify on Slack?" | ||
required: false | ||
type: boolean | ||
default: false | ||
|
||
env: | ||
ProjectFile: "src/NexusMods.App/NexusMods.App.csproj" | ||
|
||
jobs: | ||
transformInputs: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
TagVersion: ${{ steps.setOutputs.outputs.tagVersion }} | ||
RawVersion: ${{ steps.setOutputs.outputs.rawVersion }} | ||
ProjectFile: ${{ steps.setOutputs.outputs.projectFile }} | ||
|
||
steps: | ||
- name: Set Outputs | ||
id: setOutputs | ||
shell: pwsh | ||
env: | ||
InputVersion: ${{ inputs.version }} | ||
run: | | ||
$tagVersion = $env:InputVersion.StartsWith('v') ? $env:InputVersion : "v" + $env:InputVersion | ||
$rawVersion = $env:InputVersion.StartsWith('v') ? $env:InputVersion.Substring(1) : $env:InputVersion | ||
$validation = [System.Version]::Parse($rawVersion) | ||
echo "tagVersion=$tagVersion" >> $env:GITHUB_OUTPUT | ||
echo "rawVersion=$rawVersion" >> $env:GITHUB_OUTPUT | ||
echo "projectFile=${{ env.ProjectFile }}" >> $env:GITHUB_OUTPUT | ||
build-linux: | ||
needs: [ transformInputs ] | ||
uses: ./.github/workflows/build-linux-pupnet.yaml | ||
with: | ||
AppVersion: ${{ needs.transformInputs.outputs.RawVersion }} | ||
# this is a bit of a hack, you can't use environment variables here | ||
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability | ||
ProjectFile: ${{ needs.transformInputs.outputs.ProjectFile }} | ||
RetentionDays: 1 | ||
|
||
build-windows: | ||
needs: [ transformInputs ] | ||
uses: ./.github/workflows/build-windows-pupnet.yaml | ||
with: | ||
AppVersion: ${{ needs.transformInputs.outputs.RawVersion }} | ||
# this is a bit of a hack, you can't use environment variables here | ||
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability | ||
ProjectFile: ${{ needs.transformInputs.outputs.ProjectFile }} | ||
RetentionDays: 1 | ||
|
||
release-github: | ||
runs-on: ubuntu-latest | ||
needs: [ transformInputs, build-linux, build-windows ] | ||
outputs: | ||
GitHubReleaseUrl: ${{ steps.create-gh-release.outputs.url }} | ||
|
||
permissions: | ||
contents: write | ||
discussions: write | ||
|
||
steps: | ||
- name: Get Linux Archive | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.build-linux.outputs.ArtifactNameLinuxArchive }} | ||
path: bin/LinuxArchive | ||
|
||
- name: Get Linux AppImage | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.build-linux.outputs.ArtifactNameLinuxAppImage }} | ||
path: bin/LinuxAppImage | ||
|
||
- name: Get Windows Archive | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.build-windows.outputs.ArtifactNameWindowsArchive }} | ||
path: bin/WindowsArchive | ||
|
||
- name: Get Windows Inno Setup | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ needs.build-windows.outputs.ArtifactNameWindowsInnoSetup }} | ||
path: bin/WindowsInnoSetup | ||
|
||
- name: List Artifacts | ||
shell: bash | ||
run: tree bin | ||
|
||
- name: Create Release | ||
id: create-gh-release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ${{ needs.transformInputs.outputs.RawVersion }} | ||
tag_name: ${{ needs.transformInputs.outputs.TagVersion }} | ||
draft: ${{ inputs.draft }} | ||
prerelease: ${{ inputs.prerelease }} | ||
files: bin/**/* | ||
fail_on_unmatched_files: true | ||
|
||
release-nexus-mods: | ||
runs-on: ubuntu-latest | ||
needs: [ transformInputs, build-linux, build-windows ] | ||
|
||
steps: | ||
- name: Empty | ||
if: inputs.release-nexus-mods == true | ||
run: exit 0 | ||
|
||
notify-discord: | ||
runs-on: ubuntu-latest | ||
needs: [ release-github, release-nexus-mods ] | ||
|
||
steps: | ||
- name: Send Discord notification | ||
if: inputs.notify-discord == true | ||
uses: appleboy/discord-action@0.0.3 | ||
with: | ||
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} | ||
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} | ||
message: "New release is available at ${{ needs.release-github.outputs.GitHubReleaseUrl }}" | ||
username: "Release Bot" | ||
|
||
notify-slack: | ||
runs-on: ubuntu-latest | ||
needs: [ release-github, release-nexus-mods ] | ||
|
||
steps: | ||
- name: Empty | ||
if: inputs.notify-slack == true | ||
run: exit 0 |
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,13 @@ | ||
[Desktop Entry] | ||
Type=Application | ||
Name=${APP_FRIENDLY_NAME} | ||
Icon=${APP_ID} | ||
Comment=${APP_SHORT_SUMMARY} | ||
Exec=${INSTALL_EXEC} | ||
TryExec=${INSTALL_EXEC} | ||
NoDisplay=${DESKTOP_NODISPLAY} | ||
X-AppImage-Integrate=${DESKTOP_INTEGRATE} | ||
Terminal=${DESKTOP_TERMINAL} | ||
Categories=${PRIME_CATEGORY} | ||
MimeType= | ||
Keywords= |
Oops, something went wrong.