Skip to content

Commit

Permalink
Add flatpak to release assets (#1677)
Browse files Browse the repository at this point in the history
* Add flatpak to release assets

* Use remote source for .desktop and metadata

* Remove empty new line

* Prevent flatpak build on mac target
  • Loading branch information
bkneis authored Feb 28, 2025
1 parent c8d7e1a commit c4965cb
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,74 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload flatpak assets
if: matrix.settings.host == 'ubuntu-22.04' && matrix.settings.cli_only == false
uses: actions/github-script@v6
with:
script: |
const fs = require("fs")
const releaseId = "${{ needs.create-release.outputs.release_id }}"
const assetName = "DevPod.desktop"
const assetPath = `desktop/src-tauri/target/${{ matrix.settings.target }}/release/bundle/deb/DevPod_${{needs.create-release.outputs.package_version}}_amd64/data/usr/share/applications/${assetName}`
console.log("Attempting to upload release asset: ", assetName)
await github.rest.repos.uploadReleaseAsset({
headers: {
"content-type": "application/zip",
"content-length": fs.statSync(assetPath).size
},
name: assetName,
data: fs.readFileSync(assetPath),
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId
})
const mdAssetName = "DevPod.metainfo.xml"
const mdAssetPath = `desktop/src-tauri/flatpak/${mdAssetName}`
console.log("Attempting to upload release asset: ", mdAssetName)
await github.rest.repos.uploadReleaseAsset({
headers: {
"content-type": "application/zip",
"content-length": fs.statSync(mdAssetPath).size
},
name: mdAssetName,
data: fs.readFileSync(mdAssetPath),
owner: context.repo.owner,
repo: context.repo.repo,
release_id: releaseId
})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Generate updated flatpak manifest
if: matrix.settings.host == 'ubuntu-22.04' && matrix.settings.cli_only == false
run: |
export VERSION="${{ needs.create-release.outputs.original_package_version }}"
export debPath="desktop/src-tauri/target/${{ matrix.settings.target }}/release/bundle/deb/DevPod_${VERSION}_amd64.deb"
export desktopPath="desktop/src-tauri/target/${{ matrix.settings.target }}/release/bundle/deb/DevPod.desktop"
export metaPath="desktop/src-tauri/target/${{ matrix.settings.target }}/release/bundle/deb/DevPod.metainfo.xml"
export SHA256=$(sha256sum "${debPath}" | cut -f1 -d ' ')
export DESKTOP_SHA256=$(sha256sum "${desktopPath}" | cut -f1 -d ' ')
export META_SHA256=$(sha256sum "${metaPath}" | cut -f1 -d ' ')
envsubst < desktop/flatpak/sh.loft.DevPod.tmpl > desktop/flatpak/sh.loft.devpod.yaml
# - name: Updates flatpak manifest in flathub
# uses: dmnemec/copy_file_to_another_repo_action@master
# env:
# API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
# with:
# source_file: 'desktop/flatpak/sh.loft.DevPod.yaml'
# destination_repo: 'flathub/sh.loft.DevPod'
# destination_folder: ''
# user_email: '[email protected]'
# user_name: 'loftbot'
# commit_message: 'Update flatpak manifest with latest release'

publish-updates:
needs: [build-app, create-release]
if: startsWith(github.ref, 'refs/tags/v') == true
Expand Down
53 changes: 53 additions & 0 deletions desktop/flatpak/DevPod.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>sh.loft.Devpod</id>

<name>Devpod</name>
<summary>Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.</summary>
<developer_name>Loft Labs</developer_name>

<metadata_license>FSFAP</metadata_license>
<project_license>MPL-2.0</project_license>

<url type="homepage">https://devpod.sh</url>
<url type="vcs-browser">https://github.com/loft-sh/devpod</url>
<url type="bugtracker">https://github.com/loft-sh/devpod/issues</url>

<supports>
<control>pointing</control>
<control>keyboard</control>
<control>touch</control>
</supports>

<description>
<p>
Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.
</p>
</description>

<launchable type="desktop-id">sh.loft.Devpod.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://devpod.sh/docs/media/devpod-architecture-2.png</image>
<caption>Devpod Architecture</caption>
</screenshot>
<screenshot>
<image>https://devpod.sh/docs/media/add-provider-2.png</image>
<caption>Adding a Provider</caption>
</screenshot>
<screenshot>
<image>https://devpod.sh/docs/media/create-workspace-vscode-browser.png</image>
<caption>Using vscode in the browser</caption>
</screenshot>
</screenshots>

<releases>
<release type="stable" version="v0.6.10" date="2024-01-21">
<description>
<p>Release notes can be found at https://github.com/loft-sh/devpod/releases/tag/v0.6.10</p>
</description>
</release>
</releases>

<content_rating type="oars-1.1"/>
</component>
52 changes: 52 additions & 0 deletions desktop/flatpak/sh.loft.devpod.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
id: sh.loft.Devpod

runtime: org.gnome.Platform
runtime-version: '47'
sdk: org.gnome.Sdk

command: DevPod
finish-args:
- --socket=wayland # Permission needed to show the window
- --socket=fallback-x11 # Permission needed to show the window
- --device=dri # OpenGL, not necessary for all projects
- --share=ipc
- --share=network
- --socket=ssh-auth
- --socket=gpg-agent
- --filesystem=home
- --talk-name=org.freedesktop.Flatpak
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.kde.StatusNotifierWatcher
- --filesystem=xdg-run/keyring

modules:
- shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json
- name: devpod
buildsystem: simple
sources:
- type: file
url: https://github.com/loft-sh/devpod/releases/download/v${VERSION}/DevPod_${VERSION}_amd64.deb
sha256: ${SHA256} # This is required if you are using a remote source
only-arches: [x86_64] #This source is only used on x86_64 Computers
# This path points to the binary file which was created in the .deb bundle.
# Tauri also creates a folder which corresponds to the content of the unpacked .deb.
- type: file
path: devpod-wrapper
- type: file
url: https://github.com/loft-sh/devpod/releases/download/v${VERSION}/DevPod.desktop
sha256: ${DESKTOP_SHA256}
- type: file
url: https://github.com/loft-sh/devpod/releases/download/v${VERSION}/DevPod.metainfo.xml
sha256: ${META_SHA256}
build-commands:
- ar -x *.deb
- tar -xf data.tar.gz
- cp devpod-wrapper /app/bin/devpod-cli
- chmod +x /app/bin/devpod-cli
- install -Dm755 usr/bin/devpod-cli /app/bin/devpod-bin
- install -Dm755 usr/bin/DevPod /app/bin/DevPod
- install -Dm644 sh.loft.Devpod.desktop /app/share/applications/sh.loft.Devpod.desktop
- install -Dm644 usr/share/icons/hicolor/128x128/apps/DevPod.png /app/share/icons/hicolor/128x128/apps/sh.loft.Devpod.png
- install -Dm644 usr/share/icons/hicolor/32x32/apps/DevPod.png /app/share/icons/hicolor/32x32/apps/sh.loft.Devpod.png
- install -Dm644 usr/share/icons/hicolor/256x256@2/apps/DevPod.png /app/share/icons/hicolor/256x256@2/apps/sh.loft.Devpod.png
- install -Dm644 sh.loft.Devpod.metainfo.xml /app/share/metainfo/sh.loft.Devpod.metainfo.xml

0 comments on commit c4965cb

Please sign in to comment.