-
Notifications
You must be signed in to change notification settings - Fork 47
169 lines (153 loc) · 6.21 KB
/
build-linux-pupnet.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
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"
Target:
description: "The git ref to base the release on (eg: '1957a8e7', default: current head of the branch the workflow is run on)"
required: false
type: string
PupNetRepo:
type: string
required: false
description: "The URL of the PupNet repository"
default: "https://github.com/kuiperzone/PupNet-Deploy.git"
PupNetBranch:
type: string
required: false
description: "The branch or commit of PupNet to use"
default: "dabed0cc2063c5a2d2c4f780bb6718f4b90cfd16"
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-archive.outputs.artifactName }}
ArtifactUrlLinuxArchive:
description: "URL to download the Linux Archive artifact"
value: ${{ jobs.build-archive.outputs.artifactUrl }}
ArtifactNameLinuxAppImage:
description: "Name of the Artifact that contains the Linux AppImage"
value: ${{ jobs.build-appimage.outputs.artifactName }}
ArtifactUrlLinuxAppImage:
description: "URL to download the Linux AppImage artifact"
value: ${{ jobs.build-appimage.outputs.artifactUrl }}
jobs:
build-archive:
if: inputs.BuildArchive
runs-on: ubuntu-latest
outputs:
artifactName: ${{ steps.setOutputs.outputs.artifactName }}
artifactUrl: ${{ steps.upload.outputs.artifact-url }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.Target || github.sha }}
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: Build & Install PupNet
run: |
# Our use of central package management may cause PupNet to fail build
# so we lift it out to a separate directory and build it there
mkdir ../PupNet
cd ../PupNet
git clone ${{ inputs.PupNetRepo }} .
git checkout ${{ inputs.PupNetBranch }}
dotnet pack -c Release -o . -p:Version=0.0.0-nma
dotnet tool install --global --add-source . KuiperZone.PupNet --version 0.0.0-nma
- name: Create Archive
working-directory: ${{ steps.transformInputs.outputs.projectDir }}
run: pupnet -y -v ${{ inputs.AppVersion }} -k zip -p DefineConstants=INSTALLATION_METHOD_ARCHIVE
- name: Set outputs
id: setOutputs
shell: pwsh
run: |
echo "artifactName=${{ steps.transformInputs.outputs.projectName }}-${{ inputs.Target || github.sha }}-Linux-Archive" >> $env:GITHUB_OUTPUT
- name: Upload
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setOutputs.outputs.artifactName }}
path: ${{ steps.transformInputs.outputs.projectDir }}/Deploy/OUT/*.zip
if-no-files-found: error
retention-days: ${{ inputs.RetentionDays }}
build-appimage:
if: inputs.BuildAppImage
runs-on: ubuntu-latest
outputs:
artifactName: ${{ steps.setOutputs.outputs.artifactName }}
artifactUrl: ${{ steps.upload.outputs.artifact-url }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.Target || github.sha }}
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
# https://github.com/AppImage/AppImageKit/wiki/FUSE#install-fuse
- name: Install FUSE
run: sudo add-apt-repository universe && sudo apt install libfuse2
- name: Build & Install PupNet
run: |
# Our use of central package management may cause PupNet to fail build
# so we lift it out to a separate directory and build it there
mkdir ../PupNet
cd ../PupNet
git clone ${{ inputs.PupNetRepo }} .
git checkout ${{ inputs.PupNetBranch }}
dotnet pack -c Release -o . -p:Version=0.0.0-nma
dotnet tool install --global --add-source . KuiperZone.PupNet --version 0.0.0-nma
- name: Create AppImage
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 "artifactName=${{ steps.transformInputs.outputs.projectName }}-${{ inputs.Target || github.sha }}-Linux-AppImage" >> $env:GITHUB_OUTPUT
- name: Upload
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setOutputs.outputs.artifactName }}
path: ${{ steps.transformInputs.outputs.projectDir }}/Deploy/OUT/*.AppImage
if-no-files-found: error
retention-days: ${{ inputs.RetentionDays }}