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 @@ -42,6 +42,7 @@ jobs:
| --- | ----------- | ----------- |----|
| `manifest-path` | The relative path of the manifest file | Required | - |
| `bundle` | The bundle name | Optional | `app.flatpak` |
| `build-bundle` | Whether to build a bundle or not | Optional | `true` |
| `repository-name` | The repository name, used to fetch the runtime when the user download the Flatpak bundle or when building the application | Optional | `flathub` |
| `repository-url` | The repository url, used to fetch the runtime when the user download the Flatpak bundle or when building the application | Optional | `https://flathub.org/repo/flathub.flatpakrepo` |
| `run-tests` | Enable/Disable running tests. This overrides the `flatpak-builder` option of the same name, which invokes `make check` or `ninja test`. Network and X11 access is enabled, with a display server provided by `xvfb-run`. | Optional | `false` |
Expand Down
4 changes: 4 additions & 0 deletions flatpak-builder/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: "The bundle name, by default it's app.flatpak"
required: false
default: "app.flatpak"
build-bundle:
description: "Whether to build a bundle or not."
default: "true"
required: false
repository-url:
description: >
The repository used to fetch the runtime when the user downloads the
Expand Down
34 changes: 22 additions & 12 deletions flatpak-builder/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ const getModifiedManifestPath = manifestPath => {
* @param {object} manifest A flatpak manifest
* @param {object} manifestPath The flatpak manifest path
* @param {string} bundle The bundle's name
* @param {boolean} buildBundle Whether to build a bundle or not
* @param {string} repositoryUrl The repository used to install the runtime from
* @param {string} repositoryName The repository name used to install the runtime from
* @param {string} buildDir Where to build the application
Expand All @@ -170,7 +171,7 @@ const getModifiedManifestPath = manifestPath => {
* @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, mirrorScreenshotsUrl) => {
const build = async (manifest, manifestPath, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch, mirrorScreenshotsUrl) => {
const appId = manifest['app-id'] || manifest.id
const branch = manifest.branch || core.getInput('branch') || 'master'

Expand Down Expand Up @@ -202,16 +203,18 @@ const build = async (manifest, manifestPath, bundle, repositoryUrl, repositoryNa
})
}

core.info('Creating a bundle...')
await exec.exec('flatpak', [
'build-bundle',
localRepoName,
bundle,
`--runtime-repo=${repositoryUrl}`,
`--arch=${arch}`,
appId,
branch
])
if (buildBundle) {
core.info('Creating a bundle...')
await exec.exec('flatpak', [
'build-bundle',
localRepoName,
bundle,
`--runtime-repo=${repositoryUrl}`,
`--arch=${arch}`,
appId,
branch
])
}
}

/**
Expand Down Expand Up @@ -264,6 +267,7 @@ const prepareBuild = async (repositoryName, repositoryUrl, manifestPath, cacheBu
* @param {object} manifestPath The flatpak manifest path
* @param {boolean} runTests Whether to run tests or not
* @param {string} bundle The bundle's name
* @param {boolean} buildBundle Whether to build a bundle or not
* @param {string} repositoryUrl The repository used to install the runtime from
* @param {string} repositoryName the repository name to install the runtime from
* @param {string} buildDir Where to build the application
Expand All @@ -277,6 +281,7 @@ const run = async (
manifestPath,
runTests,
bundle,
buildBundle,
repositoryUrl,
repositoryName,
buildDir,
Expand Down Expand Up @@ -307,14 +312,18 @@ const run = async (
return saveManifest(modifiedManifest, modifiedManifestPath)
})
.then((manifest) => {
return build(manifest, modifiedManifestPath, bundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch, mirrorScreenshotsUrl)
return build(manifest, modifiedManifestPath, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch, mirrorScreenshotsUrl)
})
.then(() => {
if (dbusSession) {
dbusSession.kill()
dbusSession = null
}

if (!buildBundle) {
return
}

core.info('Uploading artifact...')
const artifactClient = artifact.create()

Expand Down Expand Up @@ -348,6 +357,7 @@ if (require.main === require.cache[eval('__filename')]) {
core.getInput('manifest-path'),
['y', 'yes', 'true', 'enabled', true].includes(core.getInput('run-tests')),
core.getInput('bundle') || 'app.flatpak',
['y', 'yes', 'true', 'enabled', true].includes(core.getInput('build-bundle')),
core.getInput('repository-url'),
core.getInput('repository-name'),
'flatpak_app',
Expand Down
34 changes: 22 additions & 12 deletions flatpak-builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const getModifiedManifestPath = manifestPath => {
* @param {object} manifest A flatpak manifest
* @param {object} manifestPath The flatpak manifest path
* @param {string} bundle The bundle's name
* @param {boolean} buildBundle Whether to build a bundle or not
* @param {string} repositoryUrl The repository used to install the runtime from
* @param {string} repositoryName The repository name used to install the runtime from
* @param {string} buildDir Where to build the application
Expand All @@ -164,7 +165,7 @@ const getModifiedManifestPath = manifestPath => {
* @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, mirrorScreenshotsUrl) => {
const build = async (manifest, manifestPath, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch, mirrorScreenshotsUrl) => {
const appId = manifest['app-id'] || manifest.id
const branch = manifest.branch || core.getInput('branch') || 'master'

Expand Down Expand Up @@ -196,16 +197,18 @@ const build = async (manifest, manifestPath, bundle, repositoryUrl, repositoryNa
})
}

core.info('Creating a bundle...')
await exec.exec('flatpak', [
'build-bundle',
localRepoName,
bundle,
`--runtime-repo=${repositoryUrl}`,
`--arch=${arch}`,
appId,
branch
])
if (buildBundle) {
core.info('Creating a bundle...')
await exec.exec('flatpak', [
'build-bundle',
localRepoName,
bundle,
`--runtime-repo=${repositoryUrl}`,
`--arch=${arch}`,
appId,
branch
])
}
}

/**
Expand Down Expand Up @@ -258,6 +261,7 @@ const prepareBuild = async (repositoryName, repositoryUrl, manifestPath, cacheBu
* @param {object} manifestPath The flatpak manifest path
* @param {boolean} runTests Whether to run tests or not
* @param {string} bundle The bundle's name
* @param {boolean} buildBundle Whether to build a bundle or not
* @param {string} repositoryUrl The repository used to install the runtime from
* @param {string} repositoryName the repository name to install the runtime from
* @param {string} buildDir Where to build the application
Expand All @@ -271,6 +275,7 @@ const run = async (
manifestPath,
runTests,
bundle,
buildBundle,
repositoryUrl,
repositoryName,
buildDir,
Expand Down Expand Up @@ -301,14 +306,18 @@ const run = async (
return saveManifest(modifiedManifest, modifiedManifestPath)
})
.then((manifest) => {
return build(manifest, modifiedManifestPath, bundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch, mirrorScreenshotsUrl)
return build(manifest, modifiedManifestPath, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, arch, mirrorScreenshotsUrl)
})
.then(() => {
if (dbusSession) {
dbusSession.kill()
dbusSession = null
}

if (!buildBundle) {
return
}

core.info('Uploading artifact...')
const artifactClient = artifact.create()

Expand Down Expand Up @@ -342,6 +351,7 @@ if (require.main === module) {
core.getInput('manifest-path'),
['y', 'yes', 'true', 'enabled', true].includes(core.getInput('run-tests')),
core.getInput('bundle') || 'app.flatpak',
['y', 'yes', 'true', 'enabled', true].includes(core.getInput('build-bundle')),
core.getInput('repository-url'),
core.getInput('repository-name'),
'flatpak_app',
Expand Down