-
Notifications
You must be signed in to change notification settings - Fork 94
161 lines (140 loc) · 5.36 KB
/
build_flatpak.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
---
name: build_flatpak
on:
push:
branches:
- main
# tags:
# - 'v*' # Push a tag (this is not a release!)
release: # new version with tag
types: [published]
pull_request:
page_build:
workflow_dispatch:
jobs:
flatpak:
name: "Flatpak"
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:kde-5.15-23.08
options: --privileged
steps:
- name: Infos about github ref and trigger event
run: |
echo github.event_name: ${{ github.event_name }}
echo github.ref: ${{ github.ref }}
echo github.ref_type: ${{ github.ref_type }}
echo github.ref_name: ${{ github.ref_name }}
# Example result for tagged release:
# github.event_name: release
# github.ref: refs/tags/v0.8.0a3
# github.ref_type: tag
# github.ref_name: v0.8.0a3
- name: Checkout repository
uses: actions/checkout@v4
- name: Clone flatpak manifest from Flathub
uses: GuillaumeFalourd/clone-github-repo-action@v1
with:
owner: 'flathub'
repository: 'com.github.chipmuenk.pyfda'
- name: list
run: ls
- name: Replace git tag by the commit id on which it runs
if: github.ref_type != 'tag'
run: >
sed -i 's@\&git_tag .*@\&git_tag "${{ github.sha }}"@' com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Use correct git tag
if: github.ref_type == 'tag'
run: >
sed -i 's@\&git_tag .*@\&git_tag "${{ github.ref_name }}"@' com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Replace source url
run: >
sed -i "s@\&git_url .*pyfda.git@\&git_url $GITHUB_SERVER_URL/$GITHUB_REPOSITORY@" com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Add dev build marker to cmake options
if: github.ref_type != 'tag'
run: >
sed -i 's@config-opts: \["\(.*\)"\]@config-opts: ["\1", "-DDEV_BUILD=${{ github.ref_name }}"]@' com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Replace desktop file name suffix
if: github.ref_type != 'tag'
run: >
sed -i 's@desktop-file-name-suffix: ""@desktop-file-name-suffix: " (Development)"@' com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Show Flatpak manifest
run: cat com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
- name: Build package
uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6.3
with:
bundle: com.github.chipmuenk.pyfda.flatpak
manifest-path: com.github.chipmuenk.pyfda/com.github.chipmuenk.pyfda.yaml
cache: false
branch: development
- name: Publish build artifacts
uses: actions/upload-artifact@v4
with:
path: com.github.chipmuenk.pyfda/*
name: pyfda Flatpak
Validate_appdata_file:
name: Validate appdata file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: validation
# Command copied from flathub build process
run: |
sudo apt-get update
sudo apt install flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y org.freedesktop.appstream-glib
flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate ./ressource/linux/pyfda.appdata.xml
release:
# https://github.com/marvinpinto/actions/issues/177
needs: [flatpak]
runs-on: ubuntu-latest # does not matter which
# if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4.1.7
with:
path: artifacts
- name: list artifacts folder
run: |
echo "*** Show artifacts folder: ***"
ls artifacts
echo "*** Show artifacts/pyfda Flatpak folder: ***"
ls "artifacts/pyfda Flatpak"
# This doesn't work, path / file not found
# echo "*** Show artifacts/com.github.chipmuenk.pyfda-x86_64: ***"
# ls "artifacts/com.github.chipmuenk.pyfda-x86_64"
echo "*** Show com.github.chipmuenk.pyfda-x86_64: ***"
ls "com.github.chipmuenk.pyfda-x86_64"
# - name: Update GitHub prerelease
# if: ${{ github.ref == 'refs/heads/main' }}
# uses: marvinpinto/action-automatic-releases@latest
# with:
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# automatic_release_tag: latest
# prerelease: true
# title: "Latest Build"
# files: |
# **/artifacts/pyfda Flatpak/com.github.chipmuenk.pyfda.yaml
# **/com.github.chipmuenk.pyfda-x86_64/*.flatpak
- name: Update GitHub prerelease
if: success() && github.ref_type != 'tag'
uses: pyTooling/Actions/releaser@main
with:
tag: latest
rm: false
token: ${{ secrets.GITHUB_TOKEN }}
files: |
artifacts/pyfda*Flatpak/com.github.chipmuenk.pyfda.yaml
artifacts/com.github.chipmuenk.pyfda-x86_64/*.flatpak
- name: Update versioned Github release
if: success() && github.ref_type == 'tag'
uses: pyTooling/Actions/releaser@main
with:
tag: ${{ github.ref_name }}
rm: false
token: ${{ secrets.GITHUB_TOKEN }}
files: |
artifacts/pyfda*Flatpak/com.github.chipmuenk.pyfda.yaml
artifacts/com.github.chipmuenk.pyfda-x86_64/*.flatpak
...