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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
| `cache` | Enable/Disable caching `.flatpak-builder` directory | Optional | `true` |
| `cache-key` | Specifies the cache key. CPU arch is automatically added, so there is no need to add it to the cache key. | Optional | `flatpak-builder-${sha256(manifestPath)}` |
| `arch` | Specifies the CPU architecture to build for | Optional | `x86_64` |
| `mirror-screenshots-url` | Specifies the URL to mirror screenshots | Optional | - |

#### Building for multiple CPU architectures

Expand Down
15 changes: 11 additions & 4 deletions flatpak-builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ const getModifiedManifestPath = manifestPath => {
* @param {boolean} cacheBuildDir Whether to enable caching the build directory
* @param {string} cacheKey The key used to cache the build directory
* @param {string} arch The CPU architecture to build for
* @param {string} mirrorScreenshotsUrl The URL to mirror screenshots
*/
const build = async (manifest, manifestPath, bundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch) => {
const build = async (manifest, manifestPath, bundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch, mirrorScreenshotsUrl) => {
const appId = manifest['app-id'] || manifest.id
const branch = manifest.branch || core.getInput('branch') || 'master'

Expand All @@ -157,6 +158,9 @@ const build = async (manifest, manifestPath, bundle, repositoryUrl, repositoryNa
if (cacheBuildDir) {
args.push('--ccache')
}
if (mirrorScreenshotsUrl) {
args.push(`--mirror-screenshots-url=${mirrorScreenshotsUrl}`)
}
args.push(buildDir, manifestPath)

await exec.exec('xvfb-run --auto-servernum flatpak-builder', args)
Expand Down Expand Up @@ -238,6 +242,7 @@ const prepareBuild = async (repositoryName, repositoryUrl, manifestPath, cacheBu
* @param {boolean} cacheBuildDir Whether to enable caching the build directory
* @param {string} cacheKey the default cache key if there are any
* @param {string} arch The CPU architecture to build for
* @param {string} mirrorScreenshotsUrl The URL to mirror screenshots
*/
const run = async (
manifestPath,
Expand All @@ -249,7 +254,8 @@ const run = async (
localRepoName,
cacheBuildDir,
cacheKey,
arch
arch,
mirrorScreenshotsUrl
) => {
try {
cacheKey = await prepareBuild(repositoryName, repositoryUrl, manifestPath, cacheBuildDir, cacheKey, arch)
Expand All @@ -264,7 +270,7 @@ const run = async (
return saveManifest(modifiedManifest, modifiedManifestPath)
})
.then((manifest) => {
return build(manifest, modifiedManifestPath, bundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch)
return build(manifest, modifiedManifestPath, bundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch, mirrorScreenshotsUrl)
})
.then(() => {
core.info('Uploading artifact...')
Expand Down Expand Up @@ -301,6 +307,7 @@ if (require.main === module) {
'repo',
['y', 'yes', 'true', 'enabled', true].includes(core.getInput('cache')),
core.getInput('cache-key'),
core.getInput('arch')
core.getInput('arch'),
core.getInput('mirror-screenshots-url')
)
}