From 9e2793d41396ba7359c56e95dfa4c33b2d02ca79 Mon Sep 17 00:00:00 2001 From: Michael Clark <5285928+MikesGlitch@users.noreply.github.com> Date: Wed, 4 Mar 2026 17:05:47 +0000 Subject: [PATCH] :electron: Flathub pr on publish of release assets (#7117) * flathub pr on publish of release * docs * release notes * rabbit feedback --- .github/workflows/electron-master.yml | 50 -------- .github/workflows/publish-flathub.yml | 126 +++++++++++++++++++ packages/docs/docs/contributing/releasing.md | 6 +- upcoming-release-notes/7117.md | 6 + 4 files changed, 135 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/publish-flathub.yml create mode 100644 upcoming-release-notes/7117.md diff --git a/.github/workflows/electron-master.yml b/.github/workflows/electron-master.yml index e54529e2bc..75090e0743 100644 --- a/.github/workflows/electron-master.yml +++ b/.github/workflows/electron-master.yml @@ -156,53 +156,3 @@ jobs: -NoStatus ` -AutoCommit ` -Force - - publish-flathub: - needs: build - runs-on: ubuntu-22.04 - if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} - steps: - - name: Download Linux artifacts - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 - with: - name: actual-electron-ubuntu-22.04 - - - name: Calculate AppImage SHA256 - id: appimage_sha256 - run: | - APPIMAGE_X64_SHA256=$(sha256sum Actual-linux-x86_64.AppImage | awk '{ print $1 }') - APPIMAGE_ARM64_SHA256=$(sha256sum Actual-linux-arm64.AppImage | awk '{ print $1 }') - echo "APPIMAGE_X64_SHA256=$APPIMAGE_X64_SHA256" >> "$GITHUB_ENV" - echo "APPIMAGE_ARM64_SHA256=$APPIMAGE_ARM64_SHA256" >> "$GITHUB_ENV" - - - name: Checkout Flathub repo - uses: actions/checkout@v6 - with: - repository: flathub/com.actualbudget.actual - token: ${{ secrets.FLATHUB_GITHUB_TOKEN }} - - - name: Update manifest with new SHA256 - run: | - # Replace x86_64 entry - sed -i "/x86_64.AppImage/{n;s|sha256:.*|sha256: ${{ env.APPIMAGE_X64_SHA256 }}|}" com.actualbudget.actual.yml - sed -i "/x86_64.AppImage/s|url:.*|url: https://github.com/actualbudget/actual/releases/download/v${{ needs.build.outputs.version }}/Actual-linux-x86_64.AppImage|" com.actualbudget.actual.yml - - # Replace arm64 entry - sed -i "/arm64.AppImage/{n;s|sha256:.*|sha256: ${{ env.APPIMAGE_ARM64_SHA256 }}|}" com.actualbudget.actual.yml - sed -i "/arm64.AppImage/s|url:.*|url: https://github.com/actualbudget/actual/releases/download/v${{ needs.build.outputs.version }}/Actual-linux-arm64.AppImage|" com.actualbudget.actual.yml - - cat com.actualbudget.actual.yml - - - name: Create PR in Flathub repo - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.FLATHUB_GITHUB_TOKEN }} - commit-message: 'Update Actual flatpak to version ${{ needs.build.outputs.version }}' - branch: 'release/${{ needs.build.outputs.version }}' - draft: true - title: 'Update Actual flatpak to version ${{ needs.build.outputs.version }}' - body: | - This PR updates the Actual desktop flatpak to version ${{ needs.build.outputs.version }}. - - :link: [View release notes](https://actualbudget.org/blog/release-${{ needs.build.outputs.version }}) - reviewers: 'jfdoming,MatissJanis,youngcw' # The core team that have accepted the collaborator access to the Flathub repo diff --git a/.github/workflows/publish-flathub.yml b/.github/workflows/publish-flathub.yml new file mode 100644 index 0000000000..7aa366be06 --- /dev/null +++ b/.github/workflows/publish-flathub.yml @@ -0,0 +1,126 @@ +name: Publish Flathub + +defaults: + run: + shell: bash + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: 'Release tag (e.g. v25.3.0)' + required: true + type: string + +concurrency: + group: publish-flathub + cancel-in-progress: false + +jobs: + publish-flathub: + runs-on: ubuntu-22.04 + steps: + - name: Resolve version + id: resolve_version + env: + EVENT_NAME: ${{ github.event_name }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + INPUT_TAG: ${{ inputs.tag }} + run: | + if [[ "$EVENT_NAME" == "release" ]]; then + TAG="$RELEASE_TAG" + else + TAG="$INPUT_TAG" + fi + + if [[ -z "$TAG" ]]; then + echo "::error::No tag provided" + exit 1 + fi + + # Validate tag format (v-prefixed semver, e.g. v25.3.0 or v1.2.3-beta.1) + if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then + echo "::error::Invalid tag format: $TAG (expected v-prefixed semver, e.g. v25.3.0)" + exit 1 + fi + + VERSION="${TAG#v}" + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Resolved tag=$TAG version=$VERSION" + + - name: Verify release assets exist + env: + GH_TOKEN: ${{ github.token }} + run: | + TAG="${{ steps.resolve_version.outputs.tag }}" + + echo "Checking release assets for tag $TAG..." + ASSETS=$(gh api "repos/${{ github.repository }}/releases/tags/$TAG" --jq '.assets[].name') + + echo "Found assets:" + echo "$ASSETS" + + if ! echo "$ASSETS" | grep -qx "Actual-linux-x86_64.AppImage"; then + echo "::error::Missing asset: Actual-linux-x86_64.AppImage" + exit 1 + fi + + if ! echo "$ASSETS" | grep -qx "Actual-linux-arm64.AppImage"; then + echo "::error::Missing asset: Actual-linux-arm64.AppImage" + exit 1 + fi + + echo "All required AppImage assets found." + + - name: Calculate AppImage SHA256 (streamed) + run: | + VERSION="${{ steps.resolve_version.outputs.version }}" + BASE_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}" + + echo "Streaming x86_64 AppImage to compute SHA256..." + APPIMAGE_X64_SHA256=$(curl -fSL "${BASE_URL}/Actual-linux-x86_64.AppImage" | sha256sum | awk '{ print $1 }') + echo "x86_64 SHA256: $APPIMAGE_X64_SHA256" + + echo "Streaming arm64 AppImage to compute SHA256..." + APPIMAGE_ARM64_SHA256=$(curl -fSL "${BASE_URL}/Actual-linux-arm64.AppImage" | sha256sum | awk '{ print $1 }') + echo "arm64 SHA256: $APPIMAGE_ARM64_SHA256" + + echo "APPIMAGE_X64_SHA256=$APPIMAGE_X64_SHA256" >> "$GITHUB_ENV" + echo "APPIMAGE_ARM64_SHA256=$APPIMAGE_ARM64_SHA256" >> "$GITHUB_ENV" + + - name: Checkout Flathub repo + uses: actions/checkout@v6 + with: + repository: flathub/com.actualbudget.actual + token: ${{ secrets.FLATHUB_GITHUB_TOKEN }} + + - name: Update manifest with new version + run: | + VERSION="${{ steps.resolve_version.outputs.version }}" + + # Replace x86_64 entry + sed -i "/x86_64.AppImage/{n;s|sha256:.*|sha256: ${{ env.APPIMAGE_X64_SHA256 }}|}" com.actualbudget.actual.yml + sed -i "/x86_64.AppImage/s|url:.*|url: https://github.com/actualbudget/actual/releases/download/v${VERSION}/Actual-linux-x86_64.AppImage|" com.actualbudget.actual.yml + + # Replace arm64 entry + sed -i "/arm64.AppImage/{n;s|sha256:.*|sha256: ${{ env.APPIMAGE_ARM64_SHA256 }}|}" com.actualbudget.actual.yml + sed -i "/arm64.AppImage/s|url:.*|url: https://github.com/actualbudget/actual/releases/download/v${VERSION}/Actual-linux-arm64.AppImage|" com.actualbudget.actual.yml + + echo "Updated manifest:" + cat com.actualbudget.actual.yml + + - name: Create PR in Flathub repo + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.FLATHUB_GITHUB_TOKEN }} + commit-message: 'Update Actual flatpak to version ${{ steps.resolve_version.outputs.version }}' + branch: 'release/${{ steps.resolve_version.outputs.version }}' + title: 'Update Actual flatpak to version ${{ steps.resolve_version.outputs.version }}' + body: | + This PR updates the Actual desktop flatpak to version ${{ steps.resolve_version.outputs.version }}. + + :link: [View release notes](https://actualbudget.org/blog/release-${{ steps.resolve_version.outputs.version }}) + reviewers: 'jfdoming,MatissJanis,youngcw' diff --git a/packages/docs/docs/contributing/releasing.md b/packages/docs/docs/contributing/releasing.md index 2dd7ad69ca..d4596f630b 100644 --- a/packages/docs/docs/contributing/releasing.md +++ b/packages/docs/docs/contributing/releasing.md @@ -53,15 +53,15 @@ All NPM packages should be automatically released and pushed to the NPM registry For the Windows Store desktop app, a submission will be automatically uploaded and submitted for certification. The certification process can take up to 3 business days; once complete the app will be in the Store. You can check the update status [here](https://partner.microsoft.com/en-us/dashboard) if you have permission. Note that the Store UI will not correctly reflect the submission status for about 30 minutes after submission. -For the Flathub desktop app, a draft PR will be created against the [Actual Flathub Repository](https://github.com/flathub/com.actualbudget.actual/pulls) and the core maintainers will be assigned as reviewers. Once published, a Flatpak Build will be kicked off and will validate the release. Once successful, the Core team will review the PR and merge it to `master`, which will kick off a production release to the Flathub Store. It can take anywhere from hours to a few days before the app will be available in the Flathub Store. - Finally, a draft GitHub release should be automatically created [here](https://github.com/actualbudget/actual/releases). +Once the GitHub release is published, the Flathub publish workflow will trigger for the Linux desktop app. A PR will be created against the [Actual Flathub Repository](https://github.com/flathub/com.actualbudget.actual/pulls) and the core maintainers will be assigned as reviewers. The Core team will review the PR and merge it to `master`, which will kick off a production release to the Flathub Store. It can take anywhere from hours to a few days before the app will be available in the Flathub Store. + ## Finalize the release -- [ ] Publish, approve and merge the [Flathub Release PR](https://github.com/flathub/com.actualbudget.actual/pulls) to master. - [ ] After the Docker image for the release is ready and pushed to Docker Hub, remember to deploy it and do a quick smoke test to verify things still work as expected. - [ ] Un-draft the GitHub release which will send announcement notifications to all apps. +- [ ] Approve and merge the [Flathub Release PR](https://github.com/flathub/com.actualbudget.actual/pulls) to master. - [ ] Wrap up by sending an announcement on Discord and Twitter. - [ ] Wait one to two days to see if any new bugs show up that need a patch release. If none show up, end the merge freeze. diff --git a/upcoming-release-notes/7117.md b/upcoming-release-notes/7117.md new file mode 100644 index 0000000000..3ec24b2749 --- /dev/null +++ b/upcoming-release-notes/7117.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MikesGlitch] +--- + +Automatically publish to Flathub when the GitHub release is published