Skip to content

Commit 4f03677

Browse files
authored
Merge pull request #4 from ranfdev/ci
Ci, auto release
2 parents 16855ae + 152f179 commit 4f03677

1 file changed

Lines changed: 59 additions & 13 deletions

File tree

.github/workflows/flatpak.yml

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

0 commit comments

Comments
 (0)