Skip to content

Commit 68d887f

Browse files
committed
feat: enhance Flatpak packaging process; add version check and update releases.xml generation
1 parent 669932d commit 68d887f

File tree

4 files changed

+96
-37
lines changed

4 files changed

+96
-37
lines changed

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,16 @@ run-flatpak: install-flatpak
161161
@echo "Running Flatpak with GDB..."
162162
flatpak run --devel --command=sh $(FLATPAK_APP_ID) -c "gdb -batch -ex run -ex \"bt full\" --args /app/bin/$(FLATPAK_APP_ID)"
163163

164-
package-flatpak-flathub: $(FLATPAK_MANIFEST_IN) version.txt
165-
@echo "Updating flathub manifest..."
164+
package-flatpak-flathub: $(FLATPAK_MANIFEST_IN)
165+
@echo "Checking version.txt status..."
166+
@if git status --porcelain version.txt | grep -q 'M'; then \
167+
echo "Error: version.txt has uncommitted changes. Please commit changes."; \
168+
exit 1; \
169+
fi
170+
@COMMIT=$$(git log -n 1 --pretty=format:%H -- version.txt); \
171+
echo "Updating flathub manifest for version $(VERSION) (commit $$COMMIT)..."; \
166172
sed -e "s|@LUMINANCE_SOURCE_TYPE@|git|g" \
167-
-e "s|@LUMINANCE_SOURCE_DETAILS@|url: https://github.com/sidevesh/Luminance.git\n tag: $(VERSION)|g" \
173+
-e "s|@LUMINANCE_SOURCE_DETAILS@|url: https://github.com/sidevesh/Luminance.git\\n tag: v$(VERSION)\\n commit: $$COMMIT|g" \
168174
$(FLATPAK_MANIFEST_IN) > flathub/com.sidevesh.Luminance.yml
169175

170176
lint-flatpak-flathub: package-flatpak-flathub

README.md

Lines changed: 71 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -179,63 +179,103 @@ gnome-extensions enable luminance-extension@sidevesh
179179

180180
## Note for Maintainers
181181

182-
### Updating Release Information
183-
Before building or tagging a new release, ensure that `releases.xml` is up-to-date:
182+
### Release Workflow
184183

185-
1. Create and push a new git tag for the release (e.g., `v1.4.3`)
186-
2. Generate the `releases.xml` file by running:
187-
```
188-
./scripts/generate-releases.sh
189-
```
190-
3. If you already have a releases.xml then skip step 2 and directly edit the file in step 3, adding the new version to the top of the file
191-
3. Edit the generated `releases.xml` with release information if needed
192-
4. Commit the updated `releases.xml` file to the repository
184+
The release process involves updating the version, packaging for different distributions, and then tagging/pushing.
193185

194-
The build system will fail if:
195-
- `releases.xml` does not exist
196-
- The latest version in `releases.xml` does not match the version in `version.txt`
186+
1. **Update Version & Changelog**:
187+
* Update `version.txt` with the new version number.
188+
* Update `releases.xml` using the script:
189+
```bash
190+
./scripts/generate-releases.sh
191+
```
192+
* **Commit these changes** to the main repository. This is critical because the Flatpak build step uses the commit hash of `version.txt`.
197193

198-
### Note for AUR publishers
194+
2. **Run Packaging Scripts**:
195+
Run the packaging make targets. These will update the submodules (`flathub`, `arch`) with the new version and commit hash.
196+
* For Arch: `make package-arch`
197+
* For Flatpak: `make package-flatpak-flathub` (See detailed sections below)
198+
199+
3. **Commit Submodule Changes (Local)**:
200+
Go into the submodules (`arch/` and `flathub/`) and commit the generated changes locally. **Do not push them yet.**
201+
202+
4. **Update Main Repo Submodule Pointers**:
203+
Go back to the root of the `Luminance` repository. You will see that `arch` and `flathub` folders are modified. Commit these changes to the main repository.
204+
205+
5. **Tag and Push Main Repo**:
206+
* Create a git tag for the new version (e.g., `v1.4.4`).
207+
* Push the commits and the tag to GitHub.
208+
```bash
209+
git tag v1.4.4
210+
git push origin main --tags
211+
```
212+
213+
6. **Push Submodules**:
214+
Now that the tag exists on GitHub, you can safely push the submodule changes.
215+
* Push `arch` to AUR.
216+
* Push `flathub` to the Flathub repository.
217+
218+
## Note for AUR publishers
199219

200220
Switch the arch submodule push url to the ssh url before pushing to AUR for the first time:
201-
```
221+
```bash
202222
cd arch
203223
git remote set-url --push origin ssh://aur@aur.archlinux.org/luminance.git
204224
```
205225

226+
### Packaging for Arch
227+
1. Ensure step 1 from "Release Workflow" is done and `version.txt` is committed.
228+
2. Run the packaging command:
229+
```bash
230+
make package-arch
231+
```
232+
This updates `PKGBUILD` and `.SRCINFO` in the `arch/` directory.
233+
3. Go into `arch/` and commit the changes.
234+
4. **Wait** until you have pushed the tag to the main repository (Step 5 of Release Workflow) before pushing this submodule to AUR.
235+
206236
## Note for Flatpak Packaging
207237

208238
### Prerequisites
209-
1. Install `flatpak`:
210-
2. Install `flatpak-builder` (It is recommended to use the flatpak version of the builder):
211-
```
239+
1. Install `flatpak`.
240+
2. Install `flatpak-builder` (It is recommended to use the flatpak version of the builder):
241+
```bash
212242
flatpak install -y flathub org.flatpak.Builder
213243
```
214-
3. Install the required GNOME Runtime and SDK:
215-
```
216-
flatpak install org.gnome.Platform//48 org.gnome.Sdk//48
217-
```
244+
3. Install the required GNOME Runtime and SDK:
245+
```bash
246+
flatpak install org.gnome.Platform//49 org.gnome.Sdk//49
247+
```
218248

219-
### Build and Install
249+
### Packaging for Flathub
250+
1. Ensure step 1 from "Release Workflow" is done and `version.txt` is committed.
251+
2. Run the packaging command:
252+
```bash
253+
make package-flatpak-flathub
254+
```
255+
This updates `flathub/com.sidevesh.Luminance.yml` with the URL, the new tag (which doesn't exist yet), and the commit hash of `version.txt`.
256+
3. Go into `flathub/` and commit the changes.
257+
4. **Wait** until you have pushed the tag to the main repository (Step 5 of Release Workflow) before pushing this submodule to Flathub.
258+
259+
### Build and Install Locally
220260
To build and install the Flatpak locally for testing:
221-
```
222-
make flatpak-install
261+
```bash
262+
make install-flatpak
223263
```
224264
225265
### Validate (Lint)
226266
To validate the manifest and repository against Flathub requirements:
227-
```
228-
make flatpak-lint
267+
```bash
268+
make lint-flatpak-flathub
229269
```
230270
231271
### Run the Application (with Debugging)
232-
```
233-
make flatpak-run
272+
```bash
273+
make run-flatpak
234274
```
235275
236-
### Creating a Bundle (Publishing)
276+
### Creating a Bundle
237277
To create a binary bundle `.flatpak` for distribution:
238-
```
278+
```bash
239279
make flatpak-bundle
240280
```
241281

flathub

scripts/generate-releases.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,21 @@ OUTPUT_PATH="$REPO_ROOT/$OUTPUT_FILE"
99

1010
# Check if releases.xml already exists
1111
if [ -f "$OUTPUT_PATH" ]; then
12-
echo "$OUTPUT_FILE already exists. skipping generation."
13-
echo "Please edit it manually and add the latest version entry."
12+
VERSION=$(cat "$REPO_ROOT/version.txt")
13+
DATE=$(date +%Y-%m-%d)
14+
15+
# Check if version already exists in the file
16+
if grep -q "version=\"$VERSION\"" "$OUTPUT_PATH"; then
17+
echo "Version $VERSION already exists in $OUTPUT_FILE. Skipping."
18+
else
19+
echo "Adding version $VERSION to $OUTPUT_FILE..."
20+
# Create temp file with new release at the top
21+
TEMP_FILE=$(mktemp)
22+
echo " <release version=\"$VERSION\" date=\"$DATE\"/>" > "$TEMP_FILE"
23+
cat "$OUTPUT_PATH" >> "$TEMP_FILE"
24+
mv "$TEMP_FILE" "$OUTPUT_PATH"
25+
echo "Added release $VERSION to $OUTPUT_FILE"
26+
fi
1427
exit 0
1528
fi
1629

0 commit comments

Comments
 (0)