prepare for releases

This commit is contained in:
Linus Dierheimer
2022-03-20 13:16:04 +01:00
parent 0f6e266fc3
commit 77e05b0c95
9 changed files with 52 additions and 104 deletions
+1 -2
View File
@@ -1,2 +1 @@
custom:
- paypal.me/linusdierheimer
custom: paypal.me/linusdierheimer
-50
View File
@@ -1,50 +0,0 @@
name: CMake
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
on:
workflow_dispatch:
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Install dependencies, so that CMake enables all modules
- name: install packages
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libxfconf-0-dev librpm-dev libzstd-dev
# Kick off the debian packaging
- name: Create deb package
working-directory: ${{github.workspace}}/packaging/deb
run: sh ./create-deb-pkg.sh
# Create a release draft with the fastfetch.deb file
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Debian package for ${{ github.sha }}
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{github.workspace}}/packaging/deb/fastfetch.deb
asset_name: fastfetch.deb
asset_content_type: application/vnd.debian.binary-package
@@ -10,7 +10,7 @@ env:
BUILD_TYPE: Release
jobs:
default:
check:
name: Build, Run and Analyze fastfetch
runs-on: ubuntu-latest
permissions:
@@ -50,3 +50,18 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Build deb package
run: sh packaging/deb/create.sh .
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: fastfetch
path: ./fastfetch
- name: Upload deb package
uses: actions/upload-artifact@v2
with:
name: fastfetch.deb
path: ./packaging/deb/fastfetch.deb
+4 -21
View File
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.1.0) # Threads::Threads
project(fastfetch LANGUAGES C)
project(fastfetch
VERSION 0.1.0
LANGUAGES C
)
include(GNUInstallDirs)
@@ -25,26 +28,6 @@ endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-Wl,-O3")
set(PROJECT_VERSION "r0.0" CACHE STRING "Full version")
set(PROJECT_VERSION_MAJOR "0" CACHE STRING "Major version")
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND git rev-list --count HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REV_LIST
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REV_PARSE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(PROJECT_VERSION "r${GIT_REV_LIST}.${GIT_REV_PARSE}")
set(PROJECT_VERSION_MAJOR "${GIT_REV_LIST}")
endif()
function(fastfetch_load_text FILENAME OUTVAR)
file(READ "${FILENAME}" TEMP)
string(REPLACE "\n" "\\n" TEMP "${TEMP}")
+1 -1
View File
@@ -86,7 +86,7 @@ If pkg-config fails to find the headers for a library listed in [dependencies](#
* [AUR](https://aur.archlinux.org/packages/fastfetch-git/): Packaged by me. Will install the fastfetch binary, bash completion and the presets. Git version
* [Manjaro Repositories](https://gitlab.manjaro.org/packages/community/fastfetch): Packaged by a manjaro maintainer. Usually a bit outdated.
* [Gentoo (Guru)](https://github.com/gentoo/guru/tree/master/app-misc/fastfetch): Packed by some other guy. May be out of date some times.
* DEB: You need to build deb packages yourself. Run [`packaging/deb/create-deb-pkg.sh`](packaging/deb/create-deb-pkg.sh) for that.
* DEB: Run [`packaging/deb/create.sh`](packaging/deb/create.sh) from the root directory. You can give a custom build directory as an argument.
* Manually:
* Build: Follow the [build instructions](#building).
* Install: `sudo cmake --install build --prefix /usr/local`
+1 -1
View File
@@ -3,7 +3,7 @@ Version: <VERSION>
Section: utils
Priority: extra
Architecture: amd64
Maintainer: peter@bohner.me
Maintainer: Linus@Dierheimer.de
Homepage: https://github.com/LinusDierheimer/fastfetch
Installed-Size: 410K
Description: A fast alternative to neofetch
-27
View File
@@ -1,27 +0,0 @@
#!/bin/sh
cd "$(dirname "$0")" || exit
echo "cleanup"
rm -rf ./build ./fastfetch fastfetch.deb
echo "building fastfetch"
mkdir build
cd build || exit 1
cmake ../../.. || exit 1
cmake --build . --target fastfetch "-j$(nproc)" || exit 1
echo "generating package contents"
# deb versions must start with a number, hence the 1 added before the rXXX
version="0:1$(./fastfetch --version | cut -d ' ' -f2)-0"
echo "Using package version: $version"
cd ..
cmake --install build --prefix fastfetch/usr || exit 1
mkdir -p fastfetch/DEBIAN
sed "s/<VERSION>/$version/g" control-template > fastfetch/DEBIAN/control
echo "building package"
dpkg-deb --build fastfetch || exit 1
echo "package built."
echo "cleaning up"
rm -rf build fastfetch
+28
View File
@@ -0,0 +1,28 @@
#!/bin/sh
# This script is intended to be run from the root of the repository.
# If you don't want to use build/ as build directoy, or already build the elsewere, you can give the build directoy as argument.
BUILD_DIR="${1:-build}"
ROOT_DIR="${2:-.}"
PACKAGE_DIR="${BUILD_DIR}/packaging/deb/fastfetch"
# Create missing files
mkdir -p "${BUILD_DIR}" || exit 1
if [ ! -f "${BUILD_DIR}/cmake_install.cmake" ]; then
cmake -S "${ROOT_DIR}" -B "${BUILD_DIR}" || exit 2
rm -f "${BUILD_DIR}/fastfetch" || exit 3 # Always rebuild the project if we reconfigured it
fi
if [ ! -f "${BUILD_DIR}/fastfetch" ]; then
cmake --build "${BUILD_DIR}" || exit 4
fi
# Populate the files
cmake --install "${BUILD_DIR}" --prefix "${PACKAGE_DIR}/usr" || exit 5
mkdir -p "${PACKAGE_DIR}/DEBIAN" || exit 6
sed "s/<VERSION>/$("${BUILD_DIR}/fastfetch" --version)/g" "${ROOT_DIR}/packaging/deb/control-template" > "${PACKAGE_DIR}/DEBIAN/control" || exit 7
# Create the package
dpkg-deb --build "${PACKAGE_DIR}" || exit 8
+1 -1
View File
@@ -613,7 +613,7 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
}
else if(strcasecmp(key, "-v") == 0 || strcasecmp(key, "--version") == 0)
{
puts(FASTFETCH_PROJECT_NAME" "FASTFETCH_PROJECT_VERSION);
puts(FASTFETCH_PROJECT_VERSION);
exit(0);
}
else if(strcasecmp(key, "--list-logos") == 0)