2025-01-11 11:01:44 -08:00
name : AppImage Build
on :
workflow_dispatch :
schedule :
- cron : '30 11 * * *' # 11:30 UTC, 3:30AM Pacific
push :
branches :
- '*'
env :
ACTIONS_RUNTIME_TOKEN : ${{ secrets.GITHUB_TOKEN }}
ACTIONS_RUNTIME_URL : ${{ env.GITHUB_SERVER_URL }}/api/actions_pipeline/
jobs :
2025-01-11 11:20:21 -08:00
######################################################################
## NOTE: NIM does not support arm64 Linux at the moment. Workflow
## is disabled in Gitea until this is resolved
## https://github.com/nim-lang/choosenim/issues/23
######################################################################
2025-01-11 11:01:44 -08:00
build-appimage :
runs-on : ubuntu-latest-aarch64
steps :
- name : Check out repository code
uses : actions/checkout@v4
- name : Checkout upstream
run : |
git clone --depth=1 https://git.sr.ht/~bptato/chawan
- name : Get parameters
id : vars
run : |
2025-01-13 12:41:05 -08:00
shorthash="$(cd chawan && git rev-parse --short HEAD)"
2025-01-11 11:01:44 -08:00
echo "upstream=$(cd chawan && git rev-parse HEAD)" | tee -a $GITHUB_OUTPUT
2025-01-13 12:41:05 -08:00
echo "shorthash=$shorthash" | tee -a $GITHUB_OUTPUT
2025-01-11 11:01:44 -08:00
echo "imagename=Chawan-aarch64-$(cd chawan && git rev-parse --short HEAD).AppImage" | tee -a $GITHUB_OUTPUT
2025-01-13 12:41:05 -08:00
echo "packageurl=https://git.lerch.org/api/packages/lobo/generic/chawan-appimage/${shorthash}/Chawan-aarch64-${shorthash}.AppImage" | tee -a $GITHUB_OUTPUT
2025-01-11 11:01:44 -08:00
- name : Check for built package
id : package
run : |
if [ $(curl -s -o /dev/null -w "%{http_code}" ${{ steps.vars.outputs.packageurl }}) = 200 ]; then
echo "built=true" | tee -a $GITHUB_OUTPUT
else
echo "built=false" | tee -a $GITHUB_OUTPUT
fi
- name : Build AppImage
id : build
if : steps.package.outputs.built != 'true'
run : |
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
libssh2-1-dev \
libcurl4-openssl-dev \
pkg-config \
make \
ncurses-base \
xz-utils \
gcc \
git \
file
curl https://nim-lang.org/choosenim/init.sh -OsSf
chmod 755 ./init.sh
./init.sh -y
export PATH=$HOME/.nimble/bin:$PATH
cd chawan
make submodule
make
rm -rf /usr/local/*
make install
mkdir -p AppDir/usr
cp -R /usr/local/* AppDir/usr
sed -i -e 's#/usr#././#g' AppDir/usr/bin/cha
curl -sLO https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage
chmod 755 appimagetool-aarch64.AppImage
./appimagetool-aarch64.AppImage --appimage-extract
cp squashfs-root/usr/bin/* /usr/local/bin/
cp ../chawan.desktop AppDir
cp ../icon.png AppDir
cd AppDir
ln -s usr/bin/cha AppRun
cd ../..
appimagetool chawan/AppDir
mv Chawan-aarch64.AppImage "Chawan-aarch64-$(cd chawan && git rev-parse --short HEAD).AppImage"
echo "filename=Chawan-aarch64-$(cd chawan && git rev-parse --short HEAD).AppImage" | tee -a $GITHUB_OUTPUT
- name : Publish AppImage
if : steps.package.outputs.built != 'true'
run : |
curl -s --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \
--upload-file ${{ steps.build.outputs.filename }} \
${{ steps.vars.outputs.packageurl }}
- name : Notify
uses : https://git.lerch.org/lobo/action-notify-ntfy@v2
if : failure()
with :
host : ${{ secrets.NTFY_HOST }}
topic : ${{ secrets.NTFY_TOPIC }}
user : ${{ secrets.NTFY_USER }}
password : ${{ secrets.NTFY_PASSWORD }}