Skip to content
Open
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
43 changes: 42 additions & 1 deletion .github/workflows/flatpak-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ jobs:
flatpak-builder-debug-bundle:
name: Flatpak Builder Debug Bundle
runs-on: ubuntu-latest
needs: flatpak-builder
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
options: --privileged
Expand All @@ -131,6 +130,48 @@ jobs:
cache-key: flatpak-builder-${{ github.sha }}-debug-bundle
verbose: true

flatpak-builder-artifact-name:
name: Flatpak Builder Artifact Name
runs-on: ubuntu-latest
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
options: --privileged
strategy:
fail-fast: false
matrix:
include:
- bundle:
artifact-name:
expected-artifact: app-x86_64.flatpak

- bundle: org.example.MyApp.Devel-artifact-name.flatpak
artifact-name:
expected-artifact: org.example.MyApp.Devel-artifact-name-x86_64.flatpak

- bundle: org.example.MyApp.Devel-artifact-empty-name.flatpak
artifact-name: ""
expected-artifact: org.example.MyApp.Devel-artifact-empty-name-x86_64.flatpak

- bundle: org.example.MyApp.Devel-artifact-name.flatpak
artifact-name: org.example.MyApp.Devel-artifact-name.flatpak
expected-artifact: org.example.MyApp.Devel-artifact-name.flatpak

- bundle:
artifact-name: artifact-name-test
expected-artifact: artifact-name-test
steps:
- uses: actions/checkout@v6
- uses: ./flatpak-builder
with:
bundle: ${{ matrix.bundle }}
artifact-name: ${{ matrix.artifact-name }}
manifest-path: ./flatpak-builder/tests/test-project/org.example.MyApp.yaml
verbose: true
arch: x86_64
- uses: actions/download-artifact@v8
with:
name: ${{ matrix.expected-artifact }}

tests:
name: Tests
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
| `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` |
| `artifact-name` | Name of the uploaded artifact | Optional | `app-${arch}.flatpak` |

**Note**: `repo-dir` and `state-dir` must be under the same partition.

Expand Down
4 changes: 4 additions & 0 deletions flatpak-builder/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ inputs:
"Whether to upload the resulting bundle or not as an artifact"
required: false
default: "true"
artifact-name:
description: >
"Name of the uploaded artifact. Defaults to the bundle name tagged with the architecture"
required: false
runs:
using: "node24"
main: "dist/index.js"
9 changes: 6 additions & 3 deletions flatpak-builder/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ class Configuration {
this.verbose = core.getBooleanInput('verbose')
// Upload the artifact
this.uploadArtifact = core.getBooleanInput('upload-artifact')
// Artifact name
this.artifactName = core.getInput('artifact-name') ||
// Append the arch to the bundle name to prevent conflicts in multi-arch jobs
// If a name is provided, it's on the user to prevent this
this.bundle.replace('.flatpak', '') + `-${this.arch}.flatpak`
}

async cacheKey () {
Expand Down Expand Up @@ -432,10 +437,8 @@ const run = async (config) => {

const artifactClient = new DefaultArtifactClient()
core.info('Uploading artifact...')
// Append the arch to the bundle name to prevent conflicts in multi-arch jobs
const bundleName = config.bundle.replace('.flatpak', '') + `-${config.arch}.flatpak`
const artifactFiles = config.buildDebugBundle ? [config.bundle, config.debugBundle] : [config.bundle]
return artifactClient.uploadArtifact(bundleName, artifactFiles, '.', {
return artifactClient.uploadArtifact(config.artifactName, artifactFiles, '.', {
continueOnError: false
})
})
Expand Down
9 changes: 6 additions & 3 deletions flatpak-builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class Configuration {
this.verbose = core.getBooleanInput('verbose')
// Upload the artifact
this.uploadArtifact = core.getBooleanInput('upload-artifact')
// Artifact name
this.artifactName = core.getInput('artifact-name') ||
// Append the arch to the bundle name to prevent conflicts in multi-arch jobs
// If a name is provided, it's on the user to prevent this
this.bundle.replace('.flatpak', '') + `-${this.arch}.flatpak`
}

async cacheKey () {
Expand Down Expand Up @@ -426,10 +431,8 @@ const run = async (config) => {

const artifactClient = new DefaultArtifactClient()
core.info('Uploading artifact...')
// Append the arch to the bundle name to prevent conflicts in multi-arch jobs
const bundleName = config.bundle.replace('.flatpak', '') + `-${config.arch}.flatpak`
const artifactFiles = config.buildDebugBundle ? [config.bundle, config.debugBundle] : [config.bundle]
return artifactClient.uploadArtifact(bundleName, artifactFiles, '.', {
return artifactClient.uploadArtifact(config.artifactName, artifactFiles, '.', {
continueOnError: false
})
})
Expand Down
Loading