Skip to content

Commit 51eb570

Browse files
committed
meson dist in CI
1 parent 16855ae commit 51eb570

File tree

1 file changed

+57
-13
lines changed

1 file changed

+57
-13
lines changed

.github/workflows/flatpak.yml

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,63 @@
11
on:
22
push:
3-
branches: [main]
3+
branches: [ ci ]
44
pull_request:
5-
name: CI
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: flatpak
9+
cancel-in-progress: true
10+
611
jobs:
7-
flatpak:
8-
name: "Flatpak"
12+
build-and-dist:
913
runs-on: ubuntu-latest
10-
container:
11-
image: bilelmoussaoui/flatpak-github-actions:gnome-nightly
12-
options: --privileged
14+
1315
steps:
14-
- uses: actions/checkout@v4
15-
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
16-
with:
17-
bundle: distroshelf.flatpak
18-
manifest-path: com.ranfdev.DistroShelf.json
19-
cache-key: flatpak-builder-${{ github.sha }}
16+
- name: Check out repository
17+
uses: actions/checkout@v3
18+
19+
- name: Install Flatpak & Builder
20+
run: |
21+
sudo apt-get update
22+
sudo apt-get install -y flatpak flatpak-builder
23+
# flatpak-builder is a wrapper around flatpak build that automates fetching sources,
24+
# initializing the build, building modules, and exporting the result
25+
26+
- name: Add Flathub remote
27+
run: |
28+
flatpak --user remote-add --if-not-exists flathub \
29+
https://dl.flathub.org/repo/flathub.flatpakrepo
30+
# Required to pull SDK/runtime deps
31+
32+
- name: Build & run Meson dist in sandbox
33+
run: |
34+
# Perform a clean build, installing deps from Flathub into 'build' dir
35+
flatpak-builder --user \
36+
--force-clean \
37+
--install-deps-from=flathub \
38+
--repo=repo \
39+
--keep-build-dirs \
40+
build \
41+
com.ranfdev.DistroShelf.json
42+
43+
# Test the build
44+
flatpak-builder --run build com.ranfdev.DistroShelf.json ninja test "-C.flatpak-builder/build/distroshelf/_flatpak_build"
45+
46+
# Spawn a shell inside the build sandbox and run `meson dist`
47+
flatpak-builder --run build com.ranfdev.DistroShelf.json meson dist --no-tests "-C.flatpak-builder/build/distroshelf/_flatpak_build"
48+
# `--run` spawns the build sandbox and executes the given command
49+
50+
- name: Upload Meson distribution artifact
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: meson-dist
54+
path: '.flatpak-builder/build/distroshelf/_flatpak_build/meson-dist/*.tar.xz'
55+
56+
- name: Create or update GitHub Release
57+
uses: softprops/action-gh-release@v2
58+
if: github.ref_type == 'tag'
59+
with:
60+
tag_name: ${{ github.ref_name }} # defaults to this if omitted
61+
name: Release ${{ github.ref_name }} # defaults to tag name if omitted
62+
files: '.flatpak-builder/build/distroshelf/_flatpak_build/meson-dist/*.tar.xz'
63+
generate_release_notes: true # optional: auto-generate notes

0 commit comments

Comments
 (0)