diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a18fff9..a0c46e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,8 @@ If you plan to contribute to flatpak-github-actions, here's a couple of things t For more details, we recommend looking the extensive guide at [Creating a JavaScript action](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#prerequisites) -Once you have modified the `index.js` of either `flatpak-builder` or `flat-manager` action. Make sure to compile the file to the `dist` directory. You can do so with +Once you have modified the `index.js` of either `flatpak-builder` or `flat-manager` action, make sure to compile the file to the `dist` directory. +Note: You should have already installed the npm packages of both `flatpak-builder` and `flat-manager`, with yarn. ```shell ncc build ./flatpak-builder/index.js -o ./flatpak-builder/dist/ diff --git a/README.md b/README.md index faa4749..6de40fe 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ jobs: | `arch` | Specifies the CPU architecture to build for | Optional | `x86_64` | | `mirror-screenshots-url` | Specifies the URL to mirror screenshots | Optional | - | | `gpg-sign` | The key to sign the package | Optional | - | +| `keep-build-dirs` | Keep build directories after the build finishes (passes `--keep-build-dirs` to flatpak-builder). Useful for debugging intermediate files. | Optional | `false` | | `verbose` | Enable verbosity | Optional | `false` | | `upload-artifact` | Whether to upload the resulting bundle or not as an artifact | Optional | `true` | diff --git a/flatpak-builder/action.yml b/flatpak-builder/action.yml index a058495..901f937 100644 --- a/flatpak-builder/action.yml +++ b/flatpak-builder/action.yml @@ -56,6 +56,13 @@ inputs: Defines the cache-key to use. Defaults to flatpak-builder-${arch}-${sha256(manifestPath)} required: false + keep-build-dirs: + description: > + Keep build directories after the build finishes, passing `--keep-build-dirs` flag + to flatpak-builder. + Possible values: true, enabled, yes, y. Defaults to false. + required: false + default: "false" branch: description: The flatpak branch. default: "master" diff --git a/flatpak-builder/dist/index.js b/flatpak-builder/dist/index.js index 20d0d29..61d11ca 100644 --- a/flatpak-builder/dist/index.js +++ b/flatpak-builder/dist/index.js @@ -51,6 +51,8 @@ class Configuration { this.mirrorScreenshotsUrl = core.getInput('mirror-screenshots-url') // The key to sign the package this.gpgSign = core.getInput('gpg-sign') + // Keep build directories after the build (pass --keep-build-dirs) + this.keepBuildDirs = core.getBooleanInput('keep-build-dirs') // Modified manifest path this.modifiedManifestPath = path.join( path.dirname(this.manifestPath), @@ -232,6 +234,9 @@ const build = async (manifest, manifestPath, cacheHitKey, config) => { `--default-branch=${branch}`, `--arch=${config.arch}` ] + if (config.keepBuildDirs) { + args.push('--keep-build-dirs') + } if (config.cacheBuildDir) { args.push('--ccache') } diff --git a/flatpak-builder/index.js b/flatpak-builder/index.js index 0ff63ea..2893245 100644 --- a/flatpak-builder/index.js +++ b/flatpak-builder/index.js @@ -45,6 +45,8 @@ class Configuration { this.mirrorScreenshotsUrl = core.getInput('mirror-screenshots-url') // The key to sign the package this.gpgSign = core.getInput('gpg-sign') + // Keep build directories after the build (pass --keep-build-dirs) + this.keepBuildDirs = core.getBooleanInput('keep-build-dirs') // Modified manifest path this.modifiedManifestPath = path.join( path.dirname(this.manifestPath), @@ -226,6 +228,9 @@ const build = async (manifest, manifestPath, cacheHitKey, config) => { `--default-branch=${branch}`, `--arch=${config.arch}` ] + if (config.keepBuildDirs) { + args.push('--keep-build-dirs') + } if (config.cacheBuildDir) { args.push('--ccache') }