ci(flatpak): sync with flathub (#3259)
This commit is contained in:
parent
e90b71ce62
commit
0107ca44d7
24 changed files with 415 additions and 102 deletions
80
.github/workflows/CI.yml
vendored
80
.github/workflows/CI.yml
vendored
|
|
@ -74,6 +74,8 @@ jobs:
|
|||
build_linux_flatpak:
|
||||
env:
|
||||
APP_ID: dev.lizardbyte.app.Sunshine
|
||||
NODE_VERSION: "20"
|
||||
PLATFORM_VERSION: "23.08"
|
||||
name: Linux Flatpak
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [setup_release, setup_flatpak_matrix]
|
||||
|
|
@ -97,10 +99,30 @@ jobs:
|
|||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Dependencies Linux Flatpak
|
||||
env:
|
||||
PLATFORM_VERSION: "22.08"
|
||||
- name: Setup node
|
||||
id: node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: |
|
||||
npm install --package-lock-only
|
||||
|
||||
- name: Debug package-lock.json
|
||||
run: |
|
||||
cat package-lock.json
|
||||
|
||||
- name: Setup python
|
||||
id: python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Setup Dependencies Linux Flatpak
|
||||
run: |
|
||||
python -m pip install ./packaging/linux/flatpak/deps/flatpak-builder-tools/node
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
cmake \
|
||||
|
|
@ -114,10 +136,20 @@ jobs:
|
|||
org.flatpak.Builder \
|
||||
org.freedesktop.Platform/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
org.freedesktop.Sdk/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
org.freedesktop.Sdk.Extension.node18/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
org.freedesktop.Sdk.Extension.vala/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
org.freedesktop.Sdk.Extension.node${NODE_VERSION}/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
"
|
||||
|
||||
flatpak run org.flatpak.Builder --version
|
||||
|
||||
- name: flatpak node generator
|
||||
# https://github.com/flatpak/flatpak-builder-tools/blob/master/node/README.md
|
||||
run: |
|
||||
flatpak-node-generator npm package-lock.json
|
||||
|
||||
- name: Debug generated-sources.json
|
||||
run: |
|
||||
cat generated-sources.json
|
||||
|
||||
- name: Cache Flatpak build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
|
|
@ -167,16 +199,29 @@ jobs:
|
|||
- name: Build Linux Flatpak
|
||||
working-directory: build
|
||||
run: |
|
||||
sudo su $(whoami) -c "flatpak run org.flatpak.Builder --arch=${{ matrix.arch }} --repo=repo --force-clean \
|
||||
sudo su $(whoami) -c "flatpak run org.flatpak.Builder \
|
||||
--arch=${{ matrix.arch }} \
|
||||
--force-clean \
|
||||
--repo=repo \
|
||||
--sandbox \
|
||||
--stop-at=cuda build-sunshine ${APP_ID}.yml"
|
||||
cp -r .flatpak-builder copy-of-flatpak-builder
|
||||
sudo su $(whoami) -c "flatpak run org.flatpak.Builder --arch=${{ matrix.arch }} --repo=repo --force-clean \
|
||||
sudo su $(whoami) -c "flatpak run org.flatpak.Builder \
|
||||
--arch=${{ matrix.arch }} \
|
||||
--force-clean \
|
||||
--repo=repo \
|
||||
--sandbox \
|
||||
build-sunshine ${APP_ID}.yml"
|
||||
rm -rf .flatpak-builder
|
||||
mv copy-of-flatpak-builder .flatpak-builder
|
||||
sudo su $(whoami) -c "flatpak build-bundle --arch=${{ matrix.arch }} ./repo \
|
||||
sudo su $(whoami) -c "flatpak build-bundle \
|
||||
--arch=${{ matrix.arch }} \
|
||||
./repo \
|
||||
../artifacts/sunshine_${{ matrix.arch }}.flatpak ${APP_ID}"
|
||||
sudo su $(whoami) -c "flatpak build-bundle --runtime --arch=${{ matrix.arch }} ./repo \
|
||||
sudo su $(whoami) -c "flatpak build-bundle \
|
||||
--runtime \
|
||||
--arch=${{ matrix.arch }} \
|
||||
./repo \
|
||||
../artifacts/sunshine_debug_${{ matrix.arch }}.flatpak ${APP_ID}.Debug"
|
||||
|
||||
- name: Lint Flatpak
|
||||
|
|
@ -229,6 +274,23 @@ jobs:
|
|||
# exit with the correct code
|
||||
exit $exit_code
|
||||
|
||||
- name: Package Flathub repo archive
|
||||
# copy files required to generate the Flathub repo
|
||||
if: ${{ matrix.arch == 'x86_64' }}
|
||||
run: |
|
||||
mkdir -p flathub/modules
|
||||
cp ./build/generated-sources.json ./flathub/
|
||||
cp ./build/package-lock.json ./flathub/
|
||||
cp ./build/${APP_ID}.yml ./flathub/
|
||||
cp ./build/${APP_ID}.metainfo.xml ./flathub/
|
||||
cp ./packaging/linux/flatpak/README.md ./flathub/
|
||||
cp ./packaging/linux/flatpak/flathub.json ./flathub/
|
||||
cp -r ./packaging/linux/flatpak/modules/. ./flathub/modules/
|
||||
# submodules will need to be handled in the workflow that creates the PR
|
||||
|
||||
# create the archive
|
||||
tar -czf ./artifacts/flathub.tar.gz -C ./flathub .
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
|
|
|||
187
.github/workflows/update-flathub-repo.yml
vendored
Normal file
187
.github/workflows/update-flathub-repo.yml
vendored
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
---
|
||||
# This action is a candidate to centrally manage in https://github.com/<organization>/.github/
|
||||
# If more Flathub applications are developed, consider moving this action to the organization's .github repository,
|
||||
# using the `flathub-pkg` repository label to identify repositories that should trigger this workflow.
|
||||
|
||||
# Update Flathub on release events.
|
||||
|
||||
name: Update flathub repo
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.event.release.tag_name }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
update-flathub-repo:
|
||||
env:
|
||||
FLATHUB_PKG: dev.lizardbyte.app.${{ github.event.repository.name }}
|
||||
if: >-
|
||||
github.repository_owner == 'LizardByte'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if flathub repo
|
||||
env:
|
||||
TOPIC: flathub-pkg
|
||||
id: check-label
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const topic = process.env.TOPIC;
|
||||
console.log(`Checking if repo has topic: ${topic}`);
|
||||
|
||||
const repoTopics = await github.rest.repos.getAllTopics({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo
|
||||
});
|
||||
console.log(`Repo topics: ${repoTopics.data.names}`);
|
||||
|
||||
const hasTopic = repoTopics.data.names.includes(topic);
|
||||
console.log(`Has topic: ${hasTopic}`);
|
||||
|
||||
core.setOutput('hasTopic', hasTopic);
|
||||
|
||||
- name: Check if latest GitHub release
|
||||
id: check-release
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const latestRelease = await github.rest.repos.getLatestRelease({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo
|
||||
});
|
||||
|
||||
core.setOutput('isLatestRelease', latestRelease.data.tag_name === context.payload.release.tag_name);
|
||||
|
||||
- name: Checkout
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout flathub-repo
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: "flathub/${{ env.FLATHUB_PKG }}"
|
||||
path: "flathub/${{ env.FLATHUB_PKG }}"
|
||||
|
||||
- name: Clean up legacy files
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
working-directory: flathub/${{ env.FLATHUB_PKG }}
|
||||
run: |
|
||||
rm -rf ./*
|
||||
|
||||
- name: Copy github files
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
working-directory: flathub/${{ env.FLATHUB_PKG }}
|
||||
run: |
|
||||
mkdir -p .github/ISSUE_TEMPLATE
|
||||
|
||||
# sponsors
|
||||
curl -sSL https://github.com/LizardByte/.github/raw/refs/heads/master/.github/FUNDING.yml \
|
||||
-o .github/FUNDING.yml
|
||||
# pull request template
|
||||
curl -sSL https://github.com/LizardByte/.github/raw/refs/heads/master/.github/pull_request_template.md \
|
||||
-o .github/pull_request_template.md
|
||||
# issue config
|
||||
curl -sSL https://github.com/LizardByte/.github/raw/refs/heads/master/.github/ISSUE_TEMPLATE/config.yml \
|
||||
-o .github/ISSUE_TEMPLATE/config.yml
|
||||
|
||||
- name: Download release asset
|
||||
id: download
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
uses: robinraju/release-downloader@v1.11
|
||||
with:
|
||||
repository: "${{ github.repository }}"
|
||||
tag: "${{ github.event.release.tag_name }}"
|
||||
fileName: "flathub.tar.gz"
|
||||
tarBall: false
|
||||
zipBall: false
|
||||
out-file-path: "flathub/${{ env.FLATHUB_PKG }}"
|
||||
extract: true
|
||||
|
||||
- name: Delete arhive
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
run: |
|
||||
rm -f flathub/${{ env.FLATHUB_PKG }}/flathub.tar.gz
|
||||
|
||||
- name: Update metainfo.xml
|
||||
id: update_metainfo
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
run: |
|
||||
xml_file="flathub/${{ env.FLATHUB_PKG }}/${{ env.FLATHUB_PKG }}.metainfo.xml"
|
||||
|
||||
# Extract release information
|
||||
version="${{ github.event.release.tag_name }}" && version="${version#v}"
|
||||
date="${{ github.event.release.published_at }}" && date="${date%%T*}"
|
||||
changelog="${{ github.event.release.body }}" && changelog="${changelog//&/&}" && \
|
||||
changelog="${changelog//</<}" && changelog="${changelog//>/>}"
|
||||
|
||||
# Store the old release information into a temp file to be used for precise replacement
|
||||
tmpfile=$(mktemp)
|
||||
|
||||
# Match the existing <release> block, replace it with the new data
|
||||
awk -v version="$version" -v date="$date" -v changelog="$changelog" '
|
||||
BEGIN { replaced = 0 }
|
||||
/<release version=.*>/ {
|
||||
if (!replaced) {
|
||||
print "<release version=\"" version "\" date=\"" date "\">"
|
||||
print "<description><p>" changelog "</p></description>"
|
||||
print "</release>"
|
||||
replaced = 1
|
||||
}
|
||||
}
|
||||
!/<release version=.*>/ && !/<\/release>/ { print $0 }
|
||||
' "$xml_file" > "$tmpfile"
|
||||
|
||||
# Move the updated file back to the original location
|
||||
mv "$tmpfile" "$xml_file"
|
||||
|
||||
- name: Update submodule
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
run: |
|
||||
# Get the current commit of the submodule in the main repository
|
||||
git submodule update --init packaging/linux/flatpak/deps/shared-modules
|
||||
cd ${{ github.workspace }}/packaging/linux/flatpak/deps/shared-modules
|
||||
main_commit=$(git rev-parse HEAD)
|
||||
|
||||
# update submodules
|
||||
cd ${{ github.workspace }}/flathub/${{ env.FLATHUB_PKG }}
|
||||
git submodule update --init shared-modules
|
||||
cd shared-modules
|
||||
git checkout $main_commit
|
||||
|
||||
- name: Create/Update Pull Request
|
||||
if: >-
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true' &&
|
||||
fromJson(steps.download.outputs.downloaded_files)[0]
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
path: "flathub/${{ env.FLATHUB_PKG }}"
|
||||
token: ${{ secrets.GH_BOT_TOKEN }}
|
||||
commit-message: Update ${{ env.FLATHUB_PKG }} to ${{ github.event.release.tag_name }}
|
||||
branch: bot/bump-${{ env.FLATHUB_PKG }}-${{ github.event.release.tag_name }}
|
||||
delete-branch: true
|
||||
title: "chore: Update ${{ env.FLATHUB_PKG }} to ${{ github.event.release.tag_name }}"
|
||||
body: ${{ github.event.release.body }}
|
||||
11
.github/workflows/update-homebrew-release.yml
vendored
11
.github/workflows/update-homebrew-release.yml
vendored
|
|
@ -9,7 +9,7 @@ name: Update Homebrew release
|
|||
|
||||
on:
|
||||
release:
|
||||
types: [created, edited]
|
||||
types: [released]
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.event.release.tag_name }}"
|
||||
|
|
@ -18,14 +18,13 @@ concurrency:
|
|||
jobs:
|
||||
update-homebrew-release:
|
||||
if: >-
|
||||
github.repository_owner == 'LizardByte' &&
|
||||
!github.event.release.draft && !github.event.release.prerelease
|
||||
github.repository_owner == 'LizardByte'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if Homebrew repo
|
||||
env:
|
||||
TOPIC: homebrew-pkg
|
||||
id: check
|
||||
id: check-label
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
|
|
@ -46,7 +45,7 @@ jobs:
|
|||
- name: Download release asset
|
||||
id: download
|
||||
if: >-
|
||||
steps.check.outputs.hasTopic == 'true'
|
||||
steps.check-label.outputs.hasTopic == 'true'
|
||||
uses: robinraju/release-downloader@v1.11
|
||||
with:
|
||||
repository: "${{ github.repository }}"
|
||||
|
|
@ -59,7 +58,7 @@ jobs:
|
|||
|
||||
- name: Publish Homebrew Formula
|
||||
if: >-
|
||||
steps.check.outputs.hasTopic == 'true' &&
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
fromJson(steps.download.outputs.downloaded_files)[0]
|
||||
uses: LizardByte/homebrew-release-action@v2024.919.145818
|
||||
with:
|
||||
|
|
|
|||
33
.github/workflows/update-pacman-repo.yml
vendored
33
.github/workflows/update-pacman-repo.yml
vendored
|
|
@ -9,7 +9,7 @@ name: Update pacman repo
|
|||
|
||||
on:
|
||||
release:
|
||||
types: [created, edited]
|
||||
types: [released]
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.event.release.tag_name }}"
|
||||
|
|
@ -18,14 +18,13 @@ concurrency:
|
|||
jobs:
|
||||
update-homebrew-release:
|
||||
if: >-
|
||||
github.repository_owner == 'LizardByte' &&
|
||||
!github.event.release.draft && !github.event.release.prerelease
|
||||
github.repository_owner == 'LizardByte'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if pacman repo
|
||||
env:
|
||||
TOPIC: pacman-pkg
|
||||
id: check
|
||||
id: check-label
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
|
|
@ -43,11 +42,10 @@ jobs:
|
|||
|
||||
core.setOutput('hasTopic', hasTopic);
|
||||
|
||||
- name: Check if edited release is latest GitHub release
|
||||
id: check
|
||||
- name: Check if latest GitHub release
|
||||
id: check-release
|
||||
if: >-
|
||||
github.event_name == 'release' &&
|
||||
github.event.action == 'edited'
|
||||
steps.check-label.outputs.hasTopic == 'true'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
|
|
@ -60,8 +58,8 @@ jobs:
|
|||
|
||||
- name: Checkout pacman-repo
|
||||
if: >-
|
||||
steps.check.outputs.hasTopic == 'true' &&
|
||||
steps.check.outputs.isLatestRelease == 'true'
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository_owner }}/pacman-repo
|
||||
|
|
@ -69,16 +67,16 @@ jobs:
|
|||
- name: Prep
|
||||
id: prep
|
||||
if: >-
|
||||
steps.check.outputs.hasTopic == 'true' &&
|
||||
steps.check.outputs.isLatestRelease == 'true'
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
run: |
|
||||
echo "pkg_name=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download release asset
|
||||
id: download
|
||||
if: >-
|
||||
steps.check.outputs.hasTopic == 'true' &&
|
||||
steps.check.outputs.isLatestRelease == 'true'
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true'
|
||||
uses: robinraju/release-downloader@v1.11
|
||||
with:
|
||||
repository: "${{ github.repository }}"
|
||||
|
|
@ -91,8 +89,8 @@ jobs:
|
|||
|
||||
- name: Create/Update Pull Request
|
||||
if: >-
|
||||
steps.check.outputs.hasTopic == 'true'&&
|
||||
steps.check.outputs.isLatestRelease == 'true' &&
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
steps.check-release.outputs.isLatestRelease == 'true' &&
|
||||
fromJson(steps.download.outputs.downloaded_files)[0]
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
|
|
@ -102,8 +100,7 @@ jobs:
|
|||
commit-message: Update ${{ github.repository }} to ${{ github.event.release.tag_name }}
|
||||
branch: bot/bump-${{ github.repository }}-${{ github.event.release.tag_name }}
|
||||
delete-branch: true
|
||||
base: master
|
||||
title: Update ${{ github.repository }} to ${{ github.event.release.tag_name }}
|
||||
title: "chore: Update ${{ github.repository }} to ${{ github.event.release.tag_name }}"
|
||||
body: ${{ github.event.release.body }}
|
||||
labels: |
|
||||
auto-approve
|
||||
|
|
|
|||
11
.github/workflows/update-winget-release.yml
vendored
11
.github/workflows/update-winget-release.yml
vendored
|
|
@ -9,7 +9,7 @@ name: Update Winget release
|
|||
|
||||
on:
|
||||
release:
|
||||
types: [created, edited]
|
||||
types: [released]
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.event.release.tag_name }}"
|
||||
|
|
@ -18,14 +18,13 @@ concurrency:
|
|||
jobs:
|
||||
update-winget-release:
|
||||
if: >-
|
||||
github.repository_owner == 'LizardByte' &&
|
||||
!github.event.release.draft && !github.event.release.prerelease
|
||||
github.repository_owner == 'LizardByte'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if Winget repo
|
||||
env:
|
||||
TOPIC: winget-pkg
|
||||
id: check
|
||||
id: check-label
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
|
|
@ -46,7 +45,7 @@ jobs:
|
|||
- name: Download release asset
|
||||
id: download
|
||||
if: >-
|
||||
steps.check.outputs.hasTopic == 'true'
|
||||
steps.check-label.outputs.hasTopic == 'true'
|
||||
uses: robinraju/release-downloader@v1.11
|
||||
with:
|
||||
repository: "${{ github.repository }}"
|
||||
|
|
@ -59,7 +58,7 @@ jobs:
|
|||
|
||||
- name: Release to WinGet
|
||||
if: >-
|
||||
steps.check.outputs.hasTopic == 'true' &&
|
||||
steps.check-label.outputs.hasTopic == 'true' &&
|
||||
fromJson(steps.download.outputs.downloaded_files)[0]
|
||||
uses: vedantmgoyal2009/winget-releaser@v2
|
||||
with:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue