workflow: fix release builds + merge both terminal and GUI app into a… #78
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: Release | |
| on: | |
| push: | |
| tags: "*" | |
| #paths: | |
| # trigger release workflow only if this file changed | |
| #- .github/workflows/release.yml | |
| jobs: | |
| get-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - id: version | |
| run: | | |
| echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME" | |
| echo "Tag name from github.ref_name: ${{ github.ref_name }}" | |
| echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
| build-linux-tar: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Packages | |
| run: | | |
| sudo apt-get update && sudo apt upgrade -y | |
| sudo apt-get install build-essential g++-11 libwayland-dev gettext libgtk-3-dev pkg-config libdconf-dev libglib2.0-dev libgtkmm-3.0-dev libarchive-tools -y | |
| - name: Compile | |
| run: make DEBUG=0 GUI_APP=0 CXX=x86_64-linux-gnu-g++-11 | |
| - name: Install to ./usr | |
| run: mkdir -p usr && make install DESTDIR=./usr | |
| - name: Compile (GUI app) | |
| run: make clean && make DEBUG=0 GUI_APP=1 CXX=x86_64-linux-gnu-g++-11 | |
| - name: Install the GUI components | |
| run: | | |
| install ./build/release/customfeth-gui -Dm 755 -v ./usr/bin/ | |
| mkdir -p ./usr/share/applications | |
| cp -f customfetch.desktop ./usr/share/applications/ | |
| - name: Make Release | |
| run: tar -zcf ./customfetch.tar.gz ./usr/ | |
| - name: Upload to github artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: customfetch-linux | |
| path: ./customfetch.tar.gz | |
| build-deb: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: create tmp directory | |
| run: mkdir /tmp/customfetch-2.0.0-beta1.orig | |
| - name: Install Packages | |
| run: | | |
| sudo apt-get update && sudo apt-get upgrade -y | |
| sudo apt-get install libwayland-dev g++-11 libgtk-3-dev pkg-config libgtkmm-3.0-dev libdconf-dev libglib2.0-dev libarchive-tools | |
| sudo apt-get install binutils gettext lintian debhelper devscripts debmake autoconf automake autotools-dev dh-make fakeroot xutils pbuilder -y | |
| - name: Clean | |
| run: make distclean | |
| - name: Create deb | |
| run: | | |
| cp -r $GITHUB_WORKSPACE /tmp/customfetch-2.0.0-beta1.orig | |
| cd /tmp/customfetch-2.0.0-beta1.orig/customfetch | |
| mkdir -p Debian/Debhelper/Buildsystem/ | |
| wget https://github.com/Debian/debhelper/raw/master/lib/Debian/Debhelper/Buildsystem/makefile.pm -O Debian/Debhelper/Buildsystem/make.pm | |
| sed -i "s#package Debian::Debhelper::Buildsystem::makefile#package Debian::Debhelper::Buildsystem::make#g" Debian/Debhelper/Buildsystem/make.pm | |
| sed -i "s#DEBUG=0#DEBUG=0 CXX=x86_64-linux-gnu-g++-11#g" debian/rules | |
| dpkg-buildpackage -us -uc | |
| mv ../customfetch_2.0.0-beta1_amd64.deb ../customfetch_amd64.deb | |
| - name: Upload to github artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: customfetch-deb-pkg | |
| path: /tmp/customfetch-2.0.0-beta1.orig/customfetch_amd64.deb | |
| build-deb-gui: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: create tmp directory | |
| run: mkdir /tmp/customfetch-2.0.0-beta1.orig | |
| - name: Install Packages | |
| run: | | |
| sudo apt-get update && sudo apt-get upgrade -y | |
| sudo apt-get install libwayland-dev g++-11 libgtk-3-dev pkg-config libgtkmm-3.0-dev libdconf-dev libglib2.0-dev libarchive-tools | |
| sudo apt-get install binutils lintian debhelper gettext devscripts debmake autoconf automake autotools-dev dh-make fakeroot xutils pbuilder -y | |
| - name: Clean | |
| run: make distclean | |
| - name: Create deb | |
| run: | | |
| cp -r $GITHUB_WORKSPACE /tmp/customfetch-2.0.0-beta1.orig | |
| cd /tmp/customfetch-2.0.0-beta1.orig/customfetch | |
| mkdir -p Debian/Debhelper/Buildsystem/ | |
| wget https://github.com/Debian/debhelper/raw/master/lib/Debian/Debhelper/Buildsystem/makefile.pm -O Debian/Debhelper/Buildsystem/make.pm | |
| sed -i "s#package Debian::Debhelper::Buildsystem::makefile#package Debian::Debhelper::Buildsystem::make#g" Debian/Debhelper/Buildsystem/make.pm | |
| sed -i "s#GUI_APP=0#GUI_APP=1 CXX=x86_64-linux-gnu-g++-11#g" debian/rules | |
| sed -i "/^Build-Depends:/a Depends: libgtkmm-3.0-1v5,libgtk-3-0" debian/control | |
| dpkg-buildpackage -us -uc | |
| mv ../customfetch_2.0.0-beta1_amd64.deb ../customfetch-gui_amd64.deb | |
| - name: Upload to github artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: customfetch-gui-deb-pkg | |
| path: /tmp/customfetch-2.0.0-beta1.orig/customfetch-gui_amd64.deb | |
| build-macos-tar: | |
| runs-on: macos-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install the packages | |
| run: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --overwrite fastfetch neofetch pkg-config tree llvm@19 | |
| - name: uname -a && clang++ --version | |
| run: uname -a && echo "\n" && $(brew --prefix llvm@19)/bin/clang++ --version | |
| - name: Compile and install | |
| run: | | |
| export CXX=$(brew --prefix llvm@19)/bin/clang++ | |
| mkdir build && cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Debug -DGUI_APP=0 -DCMAKE_INSTALL_PREFIX=../usr | |
| make | |
| make install | |
| cd .. | |
| - name: Compile (GUI app) | |
| run: | | |
| export CXX=$(brew --prefix llvm@19)/bin/clang++ | |
| export PKG_CONFIG_PATH="$(brew --prefix)/lib/pkgconfig:$(brew --prefix)/opt/gtkmm3/lib/pkgconfig:$(brew --prefix)/opt/gtk+3/lib/pkgconfig" | |
| rm -rf build && mkdir build && cd build | |
| cmake .. -DCMAKE_BUILD_TYPE=Debug -DGUI_APP=1 -DCMAKE_INSTALL_PREFIX=../usr | |
| make | |
| mv -f customfetch-gui ../usr/bin/ | |
| mkdir -p ../usr/share/applications | |
| mv -f ../customfetch.desktop ../usr/share/applications | |
| - name: Make release | |
| run: tar -zcf ./customfetch.tar.gz usr/ | |
| - name: Upload to github artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| if-no-files-found: error | |
| name: customfetch-macos | |
| path: ./customfetch.tar.gz | |
| release: | |
| name: Create GitHub Release | |
| needs: [build-linux-tar, build-macos-tar, build-deb-gui, build-deb, get-version] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| release-url: ${{ steps.create-release.outputs.upload_url }} | |
| steps: | |
| - name: Create Release | |
| id: create-release | |
| uses: ncipollo/release-action@v1.14.0 | |
| with: | |
| tag: ${{ needs.get-version.outputs.version }} | |
| name: customfetch ${{ needs.get-version.outputs.version }} | |
| draft: false | |
| allowUpdates: true | |
| prerelease: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| upload-binaries: | |
| name: Upload binaries to Githib relase | |
| runs-on: ubuntu-latest | |
| needs: [release, get-version] | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| - name: tree that thing | |
| run: sudo apt install tree -y && tree | |
| - uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.release-url }} | |
| asset_path: customfetch-linux/customfetch.tar.gz | |
| asset_name: customfetch-linux-${{ needs.get-version.outputs.version }}.tar.gz | |
| asset_content_type: application/tar+gz | |
| - uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.release-url }} | |
| asset_path: customfetch-macos/customfetch.tar.gz | |
| asset_name: customfetch-macos-${{ needs.get-version.outputs.version }}.tar.gz | |
| asset_content_type: application/tar+gz | |
| - uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.release-url }} | |
| asset_path: customfetch-deb-pkg/customfetch_amd64.deb | |
| asset_name: customfetch_${{ needs.get-version.outputs.version }}_amd64.deb | |
| asset_content_type: application/vnd.debian.binary-package | |
| - uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ needs.release.outputs.release-url }} | |
| asset_path: customfetch-gui-deb-pkg/customfetch-gui_amd64.deb | |
| asset_name: customfetch-gui_${{ needs.get-version.outputs.version }}_amd64.deb | |
| asset_content_type: application/vnd.debian.binary-package |