forked from ZenBrowserMirrors/zen-desktop
chore: Created automatic flatpak releases
This commit is contained in:
parent
84a5f05eb6
commit
26e158072e
3 changed files with 147 additions and 0 deletions
51
.github/workflows/alpha.yml
vendored
51
.github/workflows/alpha.yml
vendored
|
@ -355,3 +355,54 @@ jobs:
|
|||
zen.installer-generic.exe
|
||||
zen.macos-x64.dmg
|
||||
zen.macos-aarch64.dmg
|
||||
|
||||
release-flatpak:
|
||||
if: ${{ github.event.inputs.create_release == 'true' }}
|
||||
permissions: write-all
|
||||
name: Release Flatpak
|
||||
needs: [release, linux, build-data]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Update repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download linux generic build
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: zen.linux-generic.tar.bz2
|
||||
|
||||
- name: Clone flatpak repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: flathub/io.github.zen_browser.zen
|
||||
path: flatpak-repo
|
||||
token: ${{ secrets.DEPLOY_KEY }}
|
||||
|
||||
- name: Download flatpak archive
|
||||
run: |
|
||||
wget https://github.com/zen-browser/flatpak/releases/latest/download/archive.tar -O archive.tar
|
||||
|
||||
- name: Prepare flatpak manifest
|
||||
run: |
|
||||
python3 ./scripts/prepare-flatpak-release.py ${{ needs.build-data.outputs.version }}
|
||||
rm flatpak-repo/io.github.zen_browser.zen.yml
|
||||
mv flatpak/io.github.zen_browser.zen.yml flatpak-repo/io.github.zen_browser.zen.yml
|
||||
|
||||
- name: Setup git
|
||||
run: |
|
||||
cd flatpak-repo
|
||||
git config --global user.email "mauro-balades@users.noreply.github.com"
|
||||
git config --global user.name "mauro-balades"
|
||||
|
||||
- name: Create flatpak pull request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
token: ${{ secrets.DEPLOY_KEY }}
|
||||
commit-message: Update to version ${{ needs.build-data.outputs.version }}
|
||||
title: Update to version ${{ needs.build-data.outputs.version }}
|
||||
body: |
|
||||
This PR updates the Zen Browser Flatpak package to version ${{ needs.build-data.outputs.version }}. @mauro-balades
|
||||
branch: update-to-${{ needs.build-data.outputs.version }}
|
||||
base: master
|
||||
|
46
flatpak/io.github.zen_browser.zen.yml.template
Normal file
46
flatpak/io.github.zen_browser.zen.yml.template
Normal file
|
@ -0,0 +1,46 @@
|
|||
app-id: io.github.zen_browser.zen
|
||||
runtime: org.freedesktop.Platform
|
||||
runtime-version: '23.08'
|
||||
sdk: org.freedesktop.Sdk
|
||||
base: org.mozilla.firefox.BaseApp
|
||||
base-version: '23.08'
|
||||
command: launch-script.sh
|
||||
finish-args:
|
||||
- --share=ipc
|
||||
- --share=network
|
||||
- --socket=pulseaudio
|
||||
- --socket=wayland
|
||||
- --socket=fallback-x11
|
||||
- --socket=pcsc
|
||||
- --socket=cups
|
||||
- --persist=.zen
|
||||
- --filesystem=xdg-download:rw
|
||||
- --device=all
|
||||
- --talk-name=org.freedesktop.FileManager1
|
||||
- --own-name=org.mozilla.zen.*
|
||||
- --own-name=org.mpris.MediaPlayer2.firefox.*
|
||||
- --system-talk-name=org.freedesktop.NetworkManager
|
||||
- --talk-name=org.a11y.Bus
|
||||
modules:
|
||||
- name: zen_browser
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- mv zen /app/
|
||||
|
||||
- install -Dm0755 metadata/launch-script.sh ${{FLATPAK_DEST}}/bin/launch-script.sh
|
||||
- install -Dm0644 metadata/policies.json ${{FLATPAK_DEST}}/bin/distribution/policies.json
|
||||
- install -Dm0644 metadata/icons/io.github.zen_browser.zen.png ${{FLATPAK_DEST}}/share/icons/hicolor/256x256/apps/${{FLATPAK_ID}}.png
|
||||
- install -Dm0644 metadata/io.github.zen_browser.zen.metainfo.xml ${{FLATPAK_DEST}}/share/metainfo/${{FLATPAK_ID}}.metainfo.xml
|
||||
- install -Dm0644 metadata/io.github.zen_browser.zen.desktop ${{FLATPAK_DEST}}/share/applications/${{FLATPAK_ID}}.desktop
|
||||
|
||||
sources:
|
||||
- type: archive
|
||||
url: https://github.com/zen-browser/desktop/releases/download/{version}/zen.linux-generic.tar.bz2
|
||||
sha256: {linux_sha256}
|
||||
strip-components: 0
|
||||
|
||||
- type: archive
|
||||
url: https://github.com/zen-browser/flatpak/releases/latest/download/archive.tar
|
||||
sha256: {flatpak_sha256}
|
||||
strip-components: 0
|
||||
dest: metadata
|
50
scripts/prepare-flatpak-release.py
Normal file
50
scripts/prepare-flatpak-release.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import hashlib
|
||||
|
||||
FLATID = "io.github.zen_browser.zen"
|
||||
TEMPLATE = open(f"flatpak/{FLATID}.yml.template").read()
|
||||
|
||||
LINUX_ARCHIVE = "zen.linux-generic.tar.bz2"
|
||||
FLATPAK_ARCHIVE = "archive.tar"
|
||||
|
||||
VERSION = sys.argv[1]
|
||||
|
||||
def get_sha256sum(filename):
|
||||
sha256 = hashlib.sha256()
|
||||
with open(filename, "rb") as f:
|
||||
for byte_block in iter(lambda: f.read(4096), b""):
|
||||
sha256.update(byte_block)
|
||||
return sha256.hexdigest()
|
||||
|
||||
def build_template(linux_sha256, flatpak_sha256):
|
||||
return TEMPLATE.format(linux_sha256=linux_sha256,
|
||||
flatpak_sha256=flatpak_sha256,
|
||||
version=VERSION)
|
||||
|
||||
def check_required_files():
|
||||
if not os.path.exists(LINUX_ARCHIVE):
|
||||
print(f"File {LINUX_ARCHIVE} not found")
|
||||
sys.exit(1)
|
||||
if not os.path.exists(FLATPAK_ARCHIVE):
|
||||
print(f"File {FLATPAK_ARCHIVE} not found")
|
||||
sys.exit(1)
|
||||
|
||||
if not os.path.exists(f"flatpak"):
|
||||
print(f"Directory flatpak not found")
|
||||
sys.exit(1)
|
||||
|
||||
def main():
|
||||
check_required_files()
|
||||
linux_sha256 = get_sha256sum(LINUX_ARCHIVE)
|
||||
flatpak_sha256 = get_sha256sum(FLATPAK_ARCHIVE)
|
||||
|
||||
template = build_template(linux_sha256, flatpak_sha256)
|
||||
|
||||
with open(f"flatpak/{FLATID}.yml", "w") as f:
|
||||
f.write(template)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue