Repository navigation
some improvments-222222 #31
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy — Linux | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| env: | |
| BINARY_NAME: git-tree | |
| jobs: | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| build: | |
| needs: test | |
| uses: ./.github/workflows/build-linux.yml | |
| # ── 3. Package — raw binary + AppImage ──────────────────────────────────── | |
| package: | |
| name: Package Linux | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libgtk-3-dev \ | |
| libwebkit2gtk-4.1-dev \ | |
| libgit2-dev \ | |
| fuse3 \ | |
| libxdo3 \ | |
| pkg-config | |
| - name: Download Linux artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ needs.build.outputs.artifact-name }} | |
| path: dist/ | |
| - name: Rename binary | |
| run: | | |
| VERSION="${{ github.ref_name }}" | |
| mv dist/${{ env.BINARY_NAME }} dist/${{ env.BINARY_NAME }}-linux-x86_64 | |
| chmod +x dist/${{ env.BINARY_NAME }}-linux-x86_64 | |
| echo "VERSION=${VERSION}" >> "$GITHUB_ENV" | |
| # ── AppImage ──────────────────────────────────────────────────────────── | |
| - name: Download linuxdeploy + GTK plugin | |
| run: | | |
| wget -O linuxdeploy-x86_64.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
| chmod +x linuxdeploy-x86_64.AppImage | |
| # wget -O linuxdeploy-plugin-gtk.AppImage https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/releases/download/continuous/linuxdeploy-plugin-gtk-x86_64.AppImage | |
| - name: Create AppDir structure | |
| run: | | |
| mkdir -p AppDir/usr/bin | |
| mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps | |
| # Binary | |
| cp dist/${{ env.BINARY_NAME }}-linux-x86_64 AppDir/usr/bin/${{ env.BINARY_NAME }} | |
| cp assets/icon/svg/icon.svg AppDir/git-tree.svg | |
| # Icon — convert SVG to PNG if needed | |
| sudo apt-get install -y librsvg2-bin | |
| rsvg-convert -w 256 -h 256 assets/icon/svg/icon.svg \ | |
| > AppDir/usr/share/icons/hicolor/256x256/apps/${{ env.BINARY_NAME }}.png | |
| # .desktop file | |
| cat > AppDir/${{ env.BINARY_NAME }}.desktop << EOF | |
| [Desktop Entry] | |
| Name=git-tree | |
| Comment=Terminal-style git branch visualizer | |
| Exec=git-tree | |
| Icon=git-tree | |
| Terminal=false | |
| Type=Application | |
| Categories=Development; | |
| EOF | |
| - name: Build AppImage | |
| env: | |
| DEPLOY_GTK_VERSION: 3 | |
| run: | | |
| ./linuxdeploy-x86_64.AppImage \ | |
| --appdir AppDir \ | |
| -e AppDir/usr/bin/${{ env.BINARY_NAME }} \ | |
| -d AppDir/${{ env.BINARY_NAME }}.desktop \ | |
| -i AppDir/usr/share/icons/hicolor/256x256/apps/${{ env.BINARY_NAME }}.png \ | |
| --output appimage | |
| APPIMAGE=$(find . -name "*.AppImage" | grep -v linuxdeploy | head -1) | |
| mv "$APPIMAGE" dist/${{ env.BINARY_NAME }}-${{ env.VERSION }}-x86_64.AppImage | |
| - name: Compute SHA256 | |
| run: | | |
| cd dist | |
| sha256sum ${{ env.BINARY_NAME }}-linux-x86_64 \ | |
| ${{ env.BINARY_NAME }}-${{ env.VERSION }}-x86_64.AppImage \ | |
| > SHA256SUMS-linux.txt | |
| - name: Upload packaged artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-packaged-${{ github.ref_name }} | |
| path: dist/ | |
| retention-days: 7 | |
| # ── 4. GitHub Release ────────────────────────────────────────────────────── | |
| release: | |
| name: GitHub Release (Linux) | |
| needs: [build, package] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download packaged artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-packaged-${{ github.ref_name }} | |
| path: dist/ | |
| - name: Build release notes | |
| run: | | |
| VERSION=${{ github.ref_name }} | |
| if [ -f CHANGELOG.md ]; then | |
| awk "/^## \[?${VERSION#v}\]?/{found=1; next} found && /^## /{exit} found{print}" \ | |
| CHANGELOG.md > release_notes.txt | |
| fi | |
| if [ ! -s release_notes.txt ]; then | |
| cat > release_notes.txt << 'EOF' | |
| ## Linux Installation | |
| ### AppImage (recommended — no install needed) | |
| ```bash | |
| chmod +x git-tree-*-x86_64.AppImage | |
| ./git-tree-*-x86_64.AppImage | |
| ``` | |
| ### Raw binary | |
| ```bash | |
| chmod +x git-tree-linux-x86_64 | |
| ./git-tree-linux-x86_64 | |
| ``` | |
| **System deps for raw binary:** | |
| `libgit2` `webkit2gtk-4.1` `gtk3` `libxdo` | |
| EOF | |
| fi | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "git-tree ${{ github.ref_name }}" | |
| body_path: release_notes.txt | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| files: | | |
| dist/${{ env.BINARY_NAME }}-linux-x86_64 | |
| dist/${{ env.BINARY_NAME }}-${{ github.ref_name }}-x86_64.AppImage | |
| dist/SHA256SUMS-linux.txt |