Skip to content

github: fix build-rpm-packages #20

github: fix build-rpm-packages

github: fix build-rpm-packages #20

name: Build AppImage
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch full Git history and tags
- name: Determine version and dist
id: version
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
TAGGED_COMMIT=$(git describe --tags --exact-match 2>/dev/null || echo "notag")
if [ "$TAGGED_COMMIT" = "notag" ]; then
VERSION="${LATEST_TAG}+"
DIST="-git"
else
VERSION=$LATEST_TAG
DIST=""
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "DIST=$DIST" >> $GITHUB_ENV
- name: Set up CentOS 7 Docker
run: |
docker run --rm -v $(pwd):/workspace -w /workspace centos:7 /bin/bash -c "
# Update repository URLs to use the vault since CentOS 7 has reached EOL
sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*.repo
sed -i 's|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=http://vault.centos.org/7.9.2009|g' /etc/yum.repos.d/CentOS-*.repo
yum clean all
yum makecache
yum install -y epel-release
yum groupinstall -y 'Development Tools'
yum install -y gtk3-devel glib2-devel gettext-devel desktop-file-utils \
patchelf wget libtool autoconf automake pkgconfig fuse fuse-libs
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
./autogen.sh
./configure
make
mkdir -p AppDir/usr/bin
cp src/xnec2c AppDir/usr/bin/
cp resources/xnec2c.svg AppDir/usr/share/icons/hicolor/scalable/apps/
cp files/xnec2c.desktop AppDir/usr/share/applications/
# Build the AppImage with embedded runtime and include version in filename
./appimagetool-x86_64.AppImage AppDir --runtime-arch=x86_64 -n --embed-runtime
mv xnec2c*.AppImage xnec2c-${VERSION}-${{ github.sha }}.AppImage
chmod +x xnec2c-${VERSION}-${{ github.sha }}.AppImage
./xnec2c-${VERSION}-${{ github.sha }}.AppImage --appimage-extract-and-run -h
"
- name: Upload the AppImage
uses: actions/upload-artifact@v2
with:
name: xnec2c.AppImage
path: xnec2c-${VERSION}-${{ github.sha }}.AppImage