mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-08 07:10:01 +02:00
Fixed flatpak
This commit is contained in:
parent
36d6abda0d
commit
b37b2e656a
2 changed files with 59 additions and 43 deletions
50
.github/workflows/alpha.yml
vendored
50
.github/workflows/alpha.yml
vendored
|
@ -364,19 +364,21 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Update repo
|
- name: Clone flatpak repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: flathub/io.github.zen_browser.zen
|
||||||
|
token: ${{ secrets.DEPLOY_KEY }}
|
||||||
|
|
||||||
- name: Download linux generic build
|
- name: Download linux generic build
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: zen.linux-generic.tar.bz2
|
name: zen.linux-generic.tar.bz2
|
||||||
|
|
||||||
- name: Clone flatpak repo
|
- name: Update repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: flathub/io.github.zen_browser.zen
|
path: zen-browser
|
||||||
path: flatpak-repo
|
|
||||||
token: ${{ secrets.DEPLOY_KEY }}
|
token: ${{ secrets.DEPLOY_KEY }}
|
||||||
|
|
||||||
- name: Download flatpak archive
|
- name: Download flatpak archive
|
||||||
|
@ -385,22 +387,34 @@ jobs:
|
||||||
|
|
||||||
- name: Setup git
|
- name: Setup git
|
||||||
run: |
|
run: |
|
||||||
cd flatpak-repo
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "mauro-balades@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git config --global user.name "mauro-balades"
|
|
||||||
git checkout -b update-to-${{ needs.build-data.outputs.version }}
|
|
||||||
|
|
||||||
|
|
||||||
- name: Prepare flatpak manifest
|
- name: Prepare flatpak manifest
|
||||||
run: |
|
run: |
|
||||||
python3 ./scripts/prepare-flatpak-release.py ${{ needs.build-data.outputs.version }}
|
python3 ./zen-browser/scripts/prepare-flatpak-release.py \
|
||||||
rm flatpak-repo/io.github.zen_browser.zen.yml
|
--flatpak-archive archive.tar \
|
||||||
mv flatpak/io.github.zen_browser.zen.yml flatpak-repo/io.github.zen_browser.zen.yml
|
--version ${{ needs.build-data.outputs.version }} \
|
||||||
|
--linux-archive zen.linux-generic.tar.bz2 \
|
||||||
|
--output io.github.zen_browser.zen.yml \
|
||||||
|
--template-root ./zen-browser/flatpak
|
||||||
|
|
||||||
- name: Publish flatpak
|
- name: Create pull request
|
||||||
run: |
|
uses: peter-evans/create-pull-request@v6
|
||||||
cd flatpak-repo
|
env:
|
||||||
git add .
|
GIT_TRACE: 1
|
||||||
git commit -m "Update Zen Browser to ${{ needs.build-data.outputs.version }}"
|
GIT_CURL_VERBOSE: 1
|
||||||
git push origin update-to-${{ needs.build-data.outputs.version }}
|
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
|
||||||
|
git-token: ${{ secrets.DEPLOY_KEY }}
|
||||||
|
delete-branch: true
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,9 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import argparse
|
||||||
|
|
||||||
FLATID = "io.github.zen_browser.zen"
|
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):
|
def get_sha256sum(filename):
|
||||||
sha256 = hashlib.sha256()
|
sha256 = hashlib.sha256()
|
||||||
|
@ -19,31 +14,38 @@ def get_sha256sum(filename):
|
||||||
sha256.update(byte_block)
|
sha256.update(byte_block)
|
||||||
return sha256.hexdigest()
|
return sha256.hexdigest()
|
||||||
|
|
||||||
def build_template(linux_sha256, flatpak_sha256):
|
def build_template(template, linux_sha256, flatpak_sha256, version):
|
||||||
return TEMPLATE.format(linux_sha256=linux_sha256,
|
return template.format(linux_sha256=linux_sha256,
|
||||||
flatpak_sha256=flatpak_sha256,
|
flatpak_sha256=flatpak_sha256,
|
||||||
version=VERSION)
|
version=version)
|
||||||
|
|
||||||
def check_required_files():
|
def get_template(template_root):
|
||||||
if not os.path.exists(LINUX_ARCHIVE):
|
with open(f"{template_root}/{FLATID}.yml.template", "r") as f:
|
||||||
print(f"File {LINUX_ARCHIVE} not found")
|
return f.read()
|
||||||
sys.exit(1)
|
print(f"Template {template_root}/flatpak.yml not found")
|
||||||
if not os.path.exists(FLATPAK_ARCHIVE):
|
sys.exit(1)
|
||||||
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():
|
def main():
|
||||||
check_required_files()
|
parser = argparse.ArgumentParser(description='Prepare flatpak release')
|
||||||
linux_sha256 = get_sha256sum(LINUX_ARCHIVE)
|
parser.add_argument('--version', help='Version of the release', required=True)
|
||||||
flatpak_sha256 = get_sha256sum(FLATPAK_ARCHIVE)
|
parser.add_argument('--linux-archive', help='Linux archive', required=True)
|
||||||
|
parser.add_argument('--flatpak-archive', help='Flatpak archive', required=True)
|
||||||
|
parser.add_argument('--output', help='Output file', default=f"{FLATID}.yml")
|
||||||
|
parser.add_argument('--template-root', help='Template root', default="flatpak")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
template = build_template(linux_sha256, flatpak_sha256)
|
version = args.version
|
||||||
|
linux_archive = args.linux_archive
|
||||||
|
flatpak_archive = args.flatpak_archive
|
||||||
|
output = args.output
|
||||||
|
template_root = args.template_root
|
||||||
|
|
||||||
with open(f"flatpak/{FLATID}.yml", "w") as f:
|
linux_sha256 = get_sha256sum(linux_archive)
|
||||||
|
flatpak_sha256 = get_sha256sum(flatpak_archive)
|
||||||
|
|
||||||
|
template = build_template(get_template(template_root), linux_sha256, flatpak_sha256, version)
|
||||||
|
|
||||||
|
with open(output, "w") as f:
|
||||||
f.write(template)
|
f.write(template)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue