Skip to content

Commit

Permalink
add gpg-sign parameter (#102)
Browse files Browse the repository at this point in the history
* add gpg-sign parameter
  • Loading branch information
dctucker authored Apr 1, 2023
1 parent 59b5d10 commit 3c8cbdf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
| `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 | - |
| `gpg-sign` | The key to sign the package | Optional | - |

#### Building for multiple CPU architectures

Expand Down
4 changes: 4 additions & 0 deletions flatpak-builder/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ inputs:
description: >
The URL to mirror screenshots.
required: false
gpg-sign:
description: >
The key to sign the package.
required: false
runs:
using: "node16"
main: "dist/index.js"
17 changes: 12 additions & 5 deletions flatpak-builder/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ const getModifiedManifestPath = manifestPath => {
* @param {string} cacheHitKey The key used to restore the build directory
* @param {string} arch The CPU architecture to build for
* @param {string} mirrorScreenshotsUrl The URL to mirror screenshots
* @param {string} gpgSign The key to sign the package
*/
const build = async (manifest, manifestPath, stopAtModule, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, cacheHitKey, arch, mirrorScreenshotsUrl) => {
const build = async (manifest, manifestPath, stopAtModule, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, cacheHitKey, arch, mirrorScreenshotsUrl, gpgSign) => {
const appId = manifest['app-id'] || manifest.id
const branch = manifest.branch || core.getInput('branch') || 'master'

Expand All @@ -193,6 +194,9 @@ const build = async (manifest, manifestPath, stopAtModule, bundle, buildBundle,
if (mirrorScreenshotsUrl) {
args.push(`--mirror-screenshots-url=${mirrorScreenshotsUrl}`)
}
if (gpgSign) {
args.push(`--gpg-sign=${gpgSign}`)
}
if (stopAtModule) {
args.push(`--stop-at=${stopAtModule}`)
}
Expand Down Expand Up @@ -277,6 +281,7 @@ const prepareBuild = async (repositoryName, repositoryUrl, cacheBuildDir, restor
* @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
* @param {string} gpgSign The key to sign the package
*/
const run = async (
manifestPath,
Expand All @@ -292,7 +297,8 @@ const run = async (
restoreCache,
cacheKey,
arch,
mirrorScreenshotsUrl
mirrorScreenshotsUrl,
gpgSign
) => {
if (cacheBuildDir && !cacheKey) {
try {
Expand Down Expand Up @@ -327,7 +333,7 @@ const run = async (
return saveManifest(modifiedManifest, modifiedManifestPath)
})
.then((manifest) => {
return build(manifest, modifiedManifestPath, stopAtModule, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, cacheHitKey, arch, mirrorScreenshotsUrl)
return build(manifest, modifiedManifestPath, stopAtModule, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, cacheHitKey, arch, mirrorScreenshotsUrl, gpgSign)
})
.then(() => {
if (dbusSession) {
Expand Down Expand Up @@ -382,7 +388,8 @@ if (require.main === require.cache[eval('__filename')]) {
['y', 'yes', 'true', 'enabled', true].includes(core.getInput('restore-cache')),
core.getInput('cache-key'),
core.getInput('arch'),
core.getInput('mirror-screenshots-url')
core.getInput('mirror-screenshots-url'),
core.getInput('gpg-sign')
)
}

Expand Down Expand Up @@ -67842,4 +67849,4 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
/******/ module.exports = __webpack_exports__;
/******/
/******/ })()
;
;
15 changes: 11 additions & 4 deletions flatpak-builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ const getModifiedManifestPath = manifestPath => {
* @param {string} cacheHitKey The key used to restore the build directory
* @param {string} arch The CPU architecture to build for
* @param {string} mirrorScreenshotsUrl The URL to mirror screenshots
* @param {string} gpgSign The key to sign the package
*/
const build = async (manifest, manifestPath, stopAtModule, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, cacheHitKey, arch, mirrorScreenshotsUrl) => {
const build = async (manifest, manifestPath, stopAtModule, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, cacheHitKey, arch, mirrorScreenshotsUrl, gpgSign) => {
const appId = manifest['app-id'] || manifest.id
const branch = manifest.branch || core.getInput('branch') || 'master'

Expand All @@ -187,6 +188,9 @@ const build = async (manifest, manifestPath, stopAtModule, bundle, buildBundle,
if (mirrorScreenshotsUrl) {
args.push(`--mirror-screenshots-url=${mirrorScreenshotsUrl}`)
}
if (gpgSign) {
args.push(`--gpg-sign=${gpgSign}`)
}
if (stopAtModule) {
args.push(`--stop-at=${stopAtModule}`)
}
Expand Down Expand Up @@ -271,6 +275,7 @@ const prepareBuild = async (repositoryName, repositoryUrl, cacheBuildDir, restor
* @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
* @param {string} gpgSign The key to sign the package
*/
const run = async (
manifestPath,
Expand All @@ -286,7 +291,8 @@ const run = async (
restoreCache,
cacheKey,
arch,
mirrorScreenshotsUrl
mirrorScreenshotsUrl,
gpgSign
) => {
if (cacheBuildDir && !cacheKey) {
try {
Expand Down Expand Up @@ -321,7 +327,7 @@ const run = async (
return saveManifest(modifiedManifest, modifiedManifestPath)
})
.then((manifest) => {
return build(manifest, modifiedManifestPath, stopAtModule, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, cacheHitKey, arch, mirrorScreenshotsUrl)
return build(manifest, modifiedManifestPath, stopAtModule, bundle, buildBundle, repositoryUrl, repositoryName, buildDir, localRepoName, cacheBuildDir, cacheKey, cacheHitKey, arch, mirrorScreenshotsUrl, gpgSign)
})
.then(() => {
if (dbusSession) {
Expand Down Expand Up @@ -376,6 +382,7 @@ if (require.main === module) {
['y', 'yes', 'true', 'enabled', true].includes(core.getInput('restore-cache')),
core.getInput('cache-key'),
core.getInput('arch'),
core.getInput('mirror-screenshots-url')
core.getInput('mirror-screenshots-url'),
core.getInput('gpg-sign')
)
}

0 comments on commit 3c8cbdf

Please sign in to comment.