Skip to content
Open

1 #708

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/flatpak-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build Flatpak Snapshot

on:
push:
branches:
- flatpak-snapshot
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# 1. Checkout repo
- name: Checkout
uses: actions/checkout@v4
Comment on lines +16 to +17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Consider pinning GitHub Actions to specific commit SHAs for supply-chain security

Floating tags like @v4 can change over time and introduce supply-chain risk. Please pin actions/checkout (and other third-party actions in this workflow) to a specific commit SHA, with an inline comment noting the version for traceability.

Suggested implementation:

      # 1. Checkout repo
      - name: Checkout
        # v4.2.2
        uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633

If there are other third-party actions used elsewhere in this workflow file (or in other workflow files), they should also be updated to use commit SHA pins with inline comments indicating the tagged version (e.g., # vX.Y.Z) for consistency and supply-chain security.


# 2. Set up Flatpak
- name: Install Flatpak
run: |
sudo apt update
sudo apt install -y flatpak flatpak-builder git wget xz-utils

# 3. Install GNOME SDK runtime
- name: Install GNOME SDK
run: |
flatpak install --noninteractive flathub org.gnome.Sdk//46 org.gnome.Platform//46

# 4. Determine snapshot version from Git
- name: Set snapshot version
id: vars
run: |
SHORT_HASH=$(git rev-parse --short HEAD)
VERSION="0.9.3~git${SHORT_HASH}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "Snapshot version set to ${VERSION}"

# 5. Build Flatpak
- name: Build Flatpak
run: |
flatpak-builder --force-clean build-dir iptux.flatpak.yaml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Consider wiring the computed VERSION into the Flatpak build to keep metadata consistent

Right now VERSION (from the Git hash) is only used in the commit message. If iptux.flatpak.yaml defines a version or relies on --env/--default-branch, consider passing ${{ env.VERSION }} into the Flatpak build so the Flatpak metadata matches the snapshot version instead of just the GitHub Pages commit.

Suggested implementation:

      # 5. Build Flatpak
      - name: Build Flatpak
        env:
          VERSION: ${{ env.VERSION }}
        run: |
          flatpak-builder --force-clean build-dir iptux.flatpak.yaml

If iptux.flatpak.yaml does not yet reference the VERSION environment variable, you may also want to:

  1. Add ${VERSION} in the manifest’s app-id, branch, or metadata (e.g. version: ${VERSION}) as appropriate.
  2. Optionally, if you prefer using Flatpak’s CLI flags instead of env substitution, you could additionally change the run command to include flags like --default-branch=${VERSION} or --env=VERSION=${VERSION}, depending on how your manifest is structured.


# 6. Export repository to repo/
- name: Export Flatpak repo
run: |
flatpak build-export repo build-dir --collection-id=io.github.iptux

# 7. Commit & push to gh-pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: repo
publish_branch: gh-pages
user_name: "GitHub Actions"
user_email: "[email protected]"
commit_message: "Update Flatpak snapshot: ${{ env.VERSION }}"
Loading