.github/workflows/appimage.yml #53
This file contains 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
on: | |
workflow_dispatch: | |
inputs: | |
ppa: | |
description: "ppa sufix" | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run a multi-line script | |
run: | | |
name=`cat debian/changelog | head -1 | grep -o ^[^\ ]*` | |
name2=Edor | |
# | |
mkdir -p AppDir | |
file=runtime | |
arch_ai=-x86_64 | |
archfile=${file}${arch_ai} | |
kitpart () { | |
#https://github.com/AppImage/pkg2appimage | |
#urlpart=`wget -q https://github.com/AppImage/AppImageKit/releases/latest -O - | grep "${archfile}" | head -n 1 | cut -d '"' -f 2` | |
urlpart=AppImage/AppImageKit/releases/latest/download/${archfile} | |
} | |
if [ ! -e "${file}" ]; then | |
kitpart | |
#"pkg2appimage-.*-x86_64.AppImage" | |
wget -c https://github.com/${urlpart} | |
mv ${archfile} ${file} | |
chmod a+x ${file} | |
fi | |
if [ ! -e "${name}.deb" ]; then | |
arh=amd64 | |
version=`cat debian/changelog | head -1 | grep -Poe "[^\(]*(?=\))"` | |
if [ ! -e "lp2.py" ]; then | |
wget -q https://raw.githubusercontent.com/colin-i/test/master/lp2.py | |
#is already at focal sudo apt install python3-launchpadlib | |
fi | |
OUTPUT=$(python3 lp2.py ppa${{ github.event.inputs.ppa }} ${name} ${version} ${arh}) | |
wget ${OUTPUT}/+files/${name}_${version}_${arh}.deb -O ${name}.deb | |
dpkg -x ${name}.deb AppDir | |
fi | |
apd=AppDir | |
cd ${apd} | |
file2=AppRun | |
if [ ! -e "${file2}" ]; then | |
if [ -z "${urlpart}" ]; then | |
kitpart | |
fi | |
archfile2=${file2}${arch_ai} | |
urlpart=${urlpart:0:`echo ${urlpart} | grep -ob '[^/]*$' | cut -d ':' -f 1`}${archfile2} | |
wget -c https://github.com/${urlpart} | |
chmod a+x ${archfile2} | |
mv ${archfile2} ${file2} | |
fi | |
pngfile=${name}.png | |
if [ ! -e "${pngfile}" ]; then | |
wget https://github.com/colin-i/test/releases/download/1.5/${name}.png -O ${pngfile} | |
cat > ${name}.desktop <<EOF | |
[Desktop Entry] | |
Type=Application | |
Name=${name2} | |
Exec=${name} | |
Icon=${name} | |
Categories=Utility | |
EOF | |
ln -s ${pngfile} .DirIcon | |
fi | |
#metadata file | |
mi=usr/share/metainfo | |
mif=${mi}/com.colin.${name}.appdata.xml | |
if [ ! -e "${mif}" ]; then | |
page=`cat ../debian/control | grep "^Homepage" | cut -d ' ' -f2` | |
mkdir -p ${mi} | |
cat > ${mif} <<EOF | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- Copyright 2022 --> | |
<component type="desktop-application"> | |
<id>com.colin.${name}</id> | |
<metadata_license>FSFAP</metadata_license> | |
<name>${name2}</name> | |
<summary>Console editor</summary> | |
<description> | |
<ul> | |
<li>Edit text files</li> | |
<li>Find/Replace</li> | |
<li>Undo/Redo</li> | |
</ul> | |
</description> | |
<url type="homepage">${page}</url> | |
<screenshots> | |
<screenshot type="default"> | |
<caption>${name2} image</caption> | |
<image>https://raw.github.com/colin-i/${name}/master/arh/${name}.png</image> | |
</screenshot> | |
</screenshots> | |
<content_rating/> | |
</component> | |
EOF | |
fi | |
# | |
cd .. | |
# | |
if [ ! -e "${name}.AppImage" ]; then | |
mksquashfs AppDir ${name}.squashfs -root-owned -noappend | |
cat runtime >> ${name}.AppImage | |
cat ${name}.squashfs >> ${name}.AppImage | |
chmod a+x ${name}.AppImage | |
fi | |
glibc=`readelf -V ${apd}/usr/bin/edor | grep -Po "(?<= GLIBC_)[^ ]*" | sort -Vr | head -1` | |
glibc=${glibc//./-} | |
echo -n ${glibc} > version #"glibc" will not be ok for upload-artifact | |
- name: artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: appimage | |
path: | | |
./*.AppImage | |
./version |