From 0ac10f2c03ea6ff387f88fb03f2b47c1c19e5fd3 Mon Sep 17 00:00:00 2001 From: Mauro Balades Date: Sun, 4 Aug 2024 22:45:05 +0200 Subject: [PATCH] chore: Update flatpak release process --- .github/workflows/alpha.yml | 86 +++++++++++++++++++++++++++++- scripts/prepare-flatpak-release.py | 8 ++- 2 files changed, 91 insertions(+), 3 deletions(-) diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index 985760d36..5822aecfc 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -284,11 +284,83 @@ jobs: name: zen-${{ matrix.generic == true && 'generic' || 'specific' }}.AppImage path: ./dist/zen-${{ matrix.generic == true && 'generic' || 'specific' }}.AppImage + release: + if: ${{ github.event.inputs.create_release == 'true' }} + permissions: write-all + name: Release + needs: [build-data, linux, source, windows-step-3, check-release, mac, appimage] + runs-on: ubuntu-latest + + steps: + - name: Update repo + uses: actions/checkout@v4 + + - name: Git Pull + run: git pull + + - uses: actions/download-artifact@v4 + + - name: List + run: find . + + - name: Clone updates repo + uses: actions/checkout@v4 + with: + repository: zen-browser/updates-server + path: updates-server + token: ${{ secrets.DEPLOY_KEY }} + + - name: Copy update manifests + run: | + cd updates-server + mkdir -p updates + cp -a ../linux_update_manifest_generic/. updates/ + cp -a ../linux_update_manifest_specific/. updates/ + + cp -a ../windows_update_manifest_generic/. updates/ + cp -a ../windows_update_manifest_specific/. updates/ + + cp -a ../macos_update_manifest_aarch64/. updates/ + cp -a ../macos_update_manifest_x64/. updates/ + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 🚀 Update update manifests + commit_user_name: Zen Browser Robot + commit_user_email: zen-browser-bot@users.noreply.github.com + repository: ./updates-server + + - name: release-github + uses: 'marvinpinto/action-automatic-releases@latest' + with: + repo_token: '${{ secrets.DEPLOY_KEY }}' + automatic_release_tag: ${{ needs.build-data.outputs.version }} + prerelease: false + title: 'Alpha build - ${{ needs.build-data.outputs.version }} (${{ needs.build-data.outputs.build_date }})' + files: | + zen.source.tar.gz + zen.linux-generic.tar.bz2 + zen.linux-specific.tar.bz2 + zen-generic.AppImage + zen-specific.AppImage + zen.win-generic.zip + zen.win-specific.zip + linux.mar + linux-generic.mar + windows.mar + windows-generic.mar + macos-x64.mar + macos-aarch64.mar + zen.installer.exe + 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: [build-data] + needs: [release, linux, build-data] runs-on: ubuntu-latest steps: @@ -298,6 +370,11 @@ jobs: repository: flathub/io.github.zen_browser.zen token: ${{ secrets.DEPLOY_KEY }} + - name: Download linux generic build + uses: actions/download-artifact@v4 + with: + name: zen.linux-generic.tar.bz2 + - name: Update repo uses: actions/checkout@v4 with: @@ -307,7 +384,6 @@ jobs: - name: Download flatpak archive run: | wget https://github.com/zen-browser/flatpak/releases/latest/download/archive.tar -O archive.tar - wget https://github.com/zen-browser/desktop/releases/download/1.0.0-a.12/zen.linux-generic.tar.bz2 -O zen.linux-generic.tar.bz2 - name: Setup git run: | @@ -323,6 +399,12 @@ jobs: --output io.github.zen_browser.zen.yml \ --template-root ./zen-browser/flatpak + - name: Clean up + run: | + rm -rf zen-browser + rm -rf archive.tar + rm -rf zen.linux-generic.tar.bz2 + - name: Create pull request uses: peter-evans/create-pull-request@v6 env: diff --git a/scripts/prepare-flatpak-release.py b/scripts/prepare-flatpak-release.py index 181982683..4a3da1379 100644 --- a/scripts/prepare-flatpak-release.py +++ b/scripts/prepare-flatpak-release.py @@ -15,12 +15,17 @@ def get_sha256sum(filename): return sha256.hexdigest() def build_template(template, linux_sha256, flatpak_sha256, version): + print(f"Building template with version {version}") + print(f"\tLinux archive sha256: {linux_sha256}") + print(f"\tFlatpak archive sha256: {flatpak_sha256}") return template.format(linux_sha256=linux_sha256, flatpak_sha256=flatpak_sha256, version=version) def get_template(template_root): - with open(f"{template_root}/{FLATID}.yml.template", "r") as f: + file = f"{template_root}/{FLATID}.yml.template" + print(f"Reading template {file}") + with open(file, "r") as f: return f.read() print(f"Template {template_root}/flatpak.yml not found") sys.exit(1) @@ -45,6 +50,7 @@ def main(): template = build_template(get_template(template_root), linux_sha256, flatpak_sha256, version) + print(f"Writing output to {output}") with open(output, "w") as f: f.write(template)