Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51b3688410 | ||
|
|
700faee7da | ||
|
|
4d7845440c | ||
|
|
31c8b3139a | ||
|
|
ea3d534774 | ||
|
|
eefcbc86e5 |
44
.github/workflows/release.yml
vendored
44
.github/workflows/release.yml
vendored
@@ -42,9 +42,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p build/linux/opt
|
mkdir -p build/linux/opt
|
||||||
mkdir -p build/linux/usr/share/applications
|
mkdir -p build/linux/usr/share/applications
|
||||||
mkdir -p build/linux/usr/share/icons
|
mkdir -p build/linux/usr/share/pixmaps
|
||||||
cp -r dist/gotify-tray build/linux/opt/gotify-tray
|
cp -r dist/gotify-tray build/linux/opt/gotify-tray
|
||||||
cp gotify_tray/gui/images/logo.ico build/linux/usr/share/icons/gotify-tray.ico
|
cp gotify_tray/gui/images/gotify-small.png build/linux/usr/share/pixmaps/gotify-tray.png
|
||||||
cp gotifytray.desktop build/linux/usr/share/applications
|
cp gotifytray.desktop build/linux/usr/share/applications
|
||||||
find build/linux/opt/gotify-tray -type f -exec chmod 644 -- {} +
|
find build/linux/opt/gotify-tray -type f -exec chmod 644 -- {} +
|
||||||
find build/linux/opt/gotify-tray -type d -exec chmod 755 -- {} +
|
find build/linux/opt/gotify-tray -type d -exec chmod 755 -- {} +
|
||||||
@@ -64,26 +64,20 @@ jobs:
|
|||||||
--license GPLv3
|
--license GPLv3
|
||||||
- name: Check deb file
|
- name: Check deb file
|
||||||
run: ls -la dist/
|
run: ls -la dist/
|
||||||
- name: Upload artifact
|
- name: Create release
|
||||||
uses: actions/upload-artifact@v1
|
run: |
|
||||||
with:
|
RESPONSE=$(curl -X POST \
|
||||||
name: gotify-tray_${{ env.VERSION }}_amd64.deb
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
path: dist/gotify-tray_${{ env.VERSION }}_amd64.deb
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\": \"${GITHUB_REF_NAME}\", \"name\": \"Release ${GITHUB_REF_NAME}\", \"body\": \"Automated release\"}" \
|
||||||
release:
|
http://192.168.88.97:3000/api/v1/repos/kadu/gotify-tray-customized/releases)
|
||||||
runs-on: ubuntu-latest
|
echo "Release response: $RESPONSE"
|
||||||
needs: [build-deb]
|
RELEASE_ID=$(echo $RESPONSE | jq -r '.id')
|
||||||
steps:
|
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV
|
||||||
- uses: actions/checkout@v4
|
- name: Upload asset
|
||||||
- name: Set version
|
run: |
|
||||||
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
|
curl -X POST \
|
||||||
- uses: actions/download-artifact@v1
|
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||||
with:
|
-H "Content-Type: application/octet-stream" \
|
||||||
name: gotify-tray_${{ env.VERSION }}_amd64.deb
|
--data-binary @dist/gotify-tray_${VERSION}_amd64.deb \
|
||||||
- name: Release
|
http://192.168.88.97:3000/api/v1/repos/kadu/gotify-tray-customized/releases/${RELEASE_ID}/assets?name=gotify-tray_${VERSION}_amd64.deb
|
||||||
uses: marvinpinto/action-automatic-releases@latest
|
|
||||||
with:
|
|
||||||
repo_token: "${{ secrets.GITEA_TOKEN }}"
|
|
||||||
prerelease: false
|
|
||||||
files: |
|
|
||||||
gotify-tray_${{ env.VERSION }}_amd64.deb
|
|
||||||
|
|||||||
107
WORKFLOW.md
Normal file
107
WORKFLOW.md
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
# CI/CD Workflow for Gitea with Automated Debian Builds and Releases
|
||||||
|
|
||||||
|
This document describes the GitHub Actions workflow setup adapted for Gitea, enabling automated building, testing, and releasing of Debian packages for Linux applications.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The workflow automates:
|
||||||
|
- **Development builds**: Pip package builds on every push to `develop`.
|
||||||
|
- **Release builds**: Debian package creation and automated release on tags.
|
||||||
|
|
||||||
|
Key features:
|
||||||
|
- Cross-platform compatibility (Linux-focused).
|
||||||
|
- Dynamic Python version detection.
|
||||||
|
- Automated Debian packaging using PyInstaller and fpm.
|
||||||
|
- Direct Gitea API integration for releases (bypasses artifact issues).
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
### Gitea Setup
|
||||||
|
1. **Actions Enabled**: Ensure Actions are enabled in Gitea Site Administration.
|
||||||
|
2. **Runner**: Use `act_runner` or compatible runner.
|
||||||
|
3. **Secrets**: Set `GITEA_TOKEN` in repository secrets (generate a token with `repo` and `write:packages` permissions).
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
- **Python**: 3.13 (or compatible version).
|
||||||
|
- **Tools**: PyInstaller, fpm (Ruby gem), curl, jq.
|
||||||
|
- **Libraries**: PyQt6, requests, etc. (as per `requirements.txt`).
|
||||||
|
|
||||||
|
## Workflow Files
|
||||||
|
|
||||||
|
### `.github/workflows/develop.yml`
|
||||||
|
- **Trigger**: Push to `develop` branch (ignores `release` and tags).
|
||||||
|
- **Job**: `build-linux`
|
||||||
|
- Builds Python wheel.
|
||||||
|
- Uploads artifact (for testing).
|
||||||
|
|
||||||
|
### `.github/workflows/release.yml`
|
||||||
|
- **Trigger**: Push to tags (e.g., `v1.0.0`).
|
||||||
|
- **Job**: `build-deb`
|
||||||
|
- Builds PyInstaller binary.
|
||||||
|
- Creates Debian package using fpm.
|
||||||
|
- Calls Gitea API to create release and upload `.deb`.
|
||||||
|
|
||||||
|
## Key Components
|
||||||
|
|
||||||
|
### Dynamic Python Detection
|
||||||
|
```python
|
||||||
|
py_version = platform.python_version_tuple()[1]
|
||||||
|
binaries=[(f'/lib/x86_64-linux-gnu/libpython3.{py_version}.so', '.'), ...]
|
||||||
|
```
|
||||||
|
Ensures compatibility with different Python versions.
|
||||||
|
|
||||||
|
### Debian Packaging
|
||||||
|
- Uses PyInstaller to create standalone binary.
|
||||||
|
- fpm packages into `.deb` with proper file structure:
|
||||||
|
- Binary: `/opt/<app>/<app>`
|
||||||
|
- Desktop file: `/usr/share/applications/`
|
||||||
|
- Icon: `/usr/share/pixmaps/`
|
||||||
|
- Version extracted from tag: `${{github.ref_name#v}}`
|
||||||
|
|
||||||
|
### Gitea API Integration
|
||||||
|
```bash
|
||||||
|
# Create release
|
||||||
|
curl -X POST -H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
-d '{"tag_name": "'$GITHUB_REF_NAME'", "name": "Release '$GITHUB_REF_NAME'", "body": "Automated release"}' \
|
||||||
|
$GITEA_URL/api/v1/repos/$OWNER/$REPO/releases
|
||||||
|
|
||||||
|
# Upload asset
|
||||||
|
curl -X POST -H "Authorization: token $GITEA_TOKEN" \
|
||||||
|
--data-binary @dist/app.deb \
|
||||||
|
$GITEA_URL/api/v1/repos/$OWNER/$REPO/releases/$ID/assets?name=app.deb
|
||||||
|
```
|
||||||
|
Bypasses Gitea's artifact limitations.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Releasing
|
||||||
|
1. Update version in code/files as needed.
|
||||||
|
2. Run `./release.sh v1.0.0 "Release notes"`
|
||||||
|
3. Workflow builds and releases automatically.
|
||||||
|
|
||||||
|
### Customization
|
||||||
|
- **App Name**: Update `gotify-tray` references.
|
||||||
|
- **Files**: Modify PyInstaller spec, fpm commands.
|
||||||
|
- **Gitea URL**: Change API endpoints for different instances.
|
||||||
|
- **Dependencies**: Adjust `requirements.txt` and build steps.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Build Failures
|
||||||
|
- **PyInstaller**: Check Python version and lib paths.
|
||||||
|
- **fpm**: Ensure Ruby and gem are installed.
|
||||||
|
- **API Errors**: Verify `GITEA_TOKEN` and permissions.
|
||||||
|
|
||||||
|
### Icon Issues
|
||||||
|
- Use PNG icons in `/usr/share/pixmaps/`.
|
||||||
|
- Update desktop file with correct `Icon=` path.
|
||||||
|
|
||||||
|
### Artifact Alternatives
|
||||||
|
If Gitea artifacts work in your setup, replace API calls with upload/download actions.
|
||||||
|
|
||||||
|
## Benefits
|
||||||
|
- **Automation**: Zero manual intervention for releases.
|
||||||
|
- **Reusability**: Adapt for other Python/Qt apps.
|
||||||
|
- **Reliability**: Handles version detection and packaging.
|
||||||
|
|
||||||
|
For questions or adaptations, refer to the workflow YAML files.
|
||||||
@@ -3,7 +3,7 @@ Name=Gotify Tray
|
|||||||
Comment=A tray notification application for receiving messages from a Gotify server.
|
Comment=A tray notification application for receiving messages from a Gotify server.
|
||||||
Path=/opt/gotify-tray
|
Path=/opt/gotify-tray
|
||||||
Exec=/opt/gotify-tray/gotify-tray
|
Exec=/opt/gotify-tray/gotify-tray
|
||||||
Icon=/usr/share/icons/gotify-tray.ico
|
Icon=/usr/share/pixmaps/gotify-tray.png
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Network;
|
Categories=Network;
|
||||||
|
|||||||
21
release.sh
Executable file
21
release.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Script to create and push a release tag
|
||||||
|
# Usage: ./release.sh <version> [message]
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "Usage: $0 <version> [message]"
|
||||||
|
echo "Example: $0 v0.5.22 'Release v0.5.22'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION=$1
|
||||||
|
MESSAGE=${2:-"Release $VERSION"}
|
||||||
|
|
||||||
|
echo "Creating tag $VERSION with message: $MESSAGE"
|
||||||
|
git tag -a "$VERSION" -m "$MESSAGE"
|
||||||
|
|
||||||
|
echo "Pushing tag $VERSION"
|
||||||
|
git push local "$VERSION"
|
||||||
|
|
||||||
|
echo "Tag $VERSION pushed. Workflow will build and release automatically."
|
||||||
Reference in New Issue
Block a user