Skip to content

Commit 94e954c

Browse files
committed
remove schedule, add remote trigger && refactor: style update
1 parent b6a5f36 commit 94e954c

10 files changed

Lines changed: 87 additions & 120 deletions

File tree

.github/workflows/build.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: build and release by remote trigger
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
latest_tag:
7+
description: 'Latest Tag of Upstream Releases'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build-release-by-remote-trigger:
13+
runs-on: ubuntu-latest
14+
env:
15+
LATEST_TAG: ${{ inputs.latest_tag }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Build
21+
run: ./build.sh $LATEST_TAG
22+
23+
- name: Release
24+
uses: softprops/action-gh-release@v2
25+
with:
26+
tag_name: ${{ env.LATEST_TAG }}
27+
files: output/*

build.sh

Lines changed: 60 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,74 @@
11
#!/bin/sh
2+
set -e
23

3-
PACKAGE="neovide"
4-
REPO="neovide/neovide"
4+
# Check and extract version number
5+
[ $# != 1 ] && echo "Usage: $0 <latest_releases_tag>" && exit 1
6+
VERSION=$(echo "$1" | sed -n 's|[^0-9]*\([^_]*\).*|\1|p') && test "$VERSION"
57

6-
VERSION="$(cat tag)"
8+
PACKAGE=neovide
9+
REPO=neovide/neovide
710

8-
ARCH="amd64"
9-
AMD64_FILENAME="neovide-linux-x86_64.tar.gz"
10-
ARM64_FILENAME=""
11+
ARCH_LIST="amd64"
12+
AMD64_FILENAME=neovide-linux-x86_64.tar.gz
1113

12-
get_url_by_arch() {
13-
case $1 in
14-
"amd64") echo "https://github.com/$REPO/releases/latest/download/$AMD64_FILENAME" ;;
15-
"arm64") echo "https://github.com/$REPO/releases/latest/download/$ARM64_FILENAME" ;;
16-
esac
14+
prepare() {
15+
mkdir -p output tmp
16+
curl -fs "https://raw.githubusercontent.com/sigoden/dufs/refs/heads/main/CHANGELOG.md" | gzip > tmp/changelog.gz
17+
curl -fsLo "tmp/$PACKAGE.png" https://github.com/neovide/neovide/raw/refs/heads/main/assets/neovide.svg
18+
curl -fsLo "tmp/$PACKAGE.desktop" https://github.com/neovide/neovide/raw/refs/heads/main/assets/neovide.desktop
19+
sed -i "s/Icon=neovide/Icon=$PACKAGE/" "tmp/$PACKAGE.desktop"
20+
sed -i "s/Exec=neovide/Exec=$PACKAGE/" "tmp/$PACKAGE.desktop"
1721
}
1822

1923
build() {
20-
# Prepare
21-
BASE_DIR="$PACKAGE"_"$VERSION"-1_"$1"
22-
cp -r templates "$BASE_DIR"
23-
sed -i "s/Architecture: arch/Architecture: $1/" "$BASE_DIR/DEBIAN/control"
24-
sed -i "s/Version: version/Version: $VERSION-1/" "$BASE_DIR/DEBIAN/control"
24+
BASE_DIR="$PACKAGE"_"$ARCH" && rm -rf "$BASE_DIR"
25+
install -D templates/copyright -t "$BASE_DIR/usr/share/doc/$PACKAGE"
26+
install -D tmp/changelog.gz -t "$BASE_DIR/usr/share/doc/$PACKAGE"
27+
2528
# Download and move file
26-
curl https://api.github.com/repos/$REPO/releases/latest | jq -r '.body' > $BASE_DIR/usr/share/doc/$PACKAGE/CHANGELOG.md
27-
curl -Lo $BASE_DIR/usr/share/applications/neovide.desktop https://github.com/neovide/neovide/raw/refs/heads/main/assets/neovide.desktop
28-
curl -Lo $BASE_DIR/usr/share/icons/hicolor/256x256/apps/neovide.png https://github.com/neovide/neovide/raw/main/assets/neovide-256x256.png
29-
curl -sLo "$PACKAGE-$VERSION-$1.tar.gz" "$(get_url_by_arch $1)"
30-
tar -xzf "$PACKAGE-$VERSION-$1.tar.gz"
31-
mv "$PACKAGE" "$BASE_DIR/usr/bin/$PACKAGE"
32-
chmod 755 "$BASE_DIR/usr/bin/$PACKAGE"
33-
# Build
34-
dpkg-deb --build --root-owner-group -Z xz "$BASE_DIR"
29+
curl -fsLo "tmp/$PACKAGE-$ARCH.tar.gz" "$(get_url_by_arch "$ARCH")"
30+
tar -xf "tmp/$PACKAGE-$ARCH.tar.gz"
31+
install -D -m 755 -t "$BASE_DIR/usr/bin" neovide && rm neovide
32+
33+
install -D "tmp/$PACKAGE.desktop" -t "$BASE_DIR/usr/share/applications"
34+
install -D "tmp/$PACKAGE.png" -t "$BASE_DIR/usr/share/icons/hicolor/scalable/apps"
35+
36+
# Package deb
37+
mkdir -p "$BASE_DIR/DEBIAN"
38+
SIZE=$(du -sk "$BASE_DIR"/usr | cut -f1)
39+
echo "Package: $PACKAGE
40+
Version: $VERSION-1
41+
Architecture: $ARCH
42+
Installed-Size: $SIZE
43+
Maintainer: wcbing <i@wcbing.top>
44+
Section: editors
45+
Priority: optional
46+
Depends: neovim
47+
Homepage: https://github.com/$REPO
48+
Description: This is a simple graphical user interface for Neovim
49+
(an aggressively refactored and updated Vim editor).
50+
Where possible there are some graphical improvements, but functionally
51+
it should act like the terminal UI.
52+
To checkout all the cool features, installation instructions,
53+
configuration settings and much more, head on over to neovide.dev.
54+
" > "$BASE_DIR/DEBIAN/control"
55+
56+
dpkg-deb -b --root-owner-group -Z xz "$BASE_DIR" output
3557
}
3658

37-
for i in $ARCH; do
38-
echo "Building $i package..."
39-
build "$i"
59+
get_url_by_arch() {
60+
DOWNLOAD_PREFIX="https://github.com/$REPO/releases/latest/download"
61+
case $1 in
62+
"amd64") echo "$DOWNLOAD_PREFIX/$AMD64_FILENAME" ;;
63+
esac
64+
}
65+
66+
prepare
67+
68+
for ARCH in $ARCH_LIST; do
69+
echo "Building $ARCH package..."
70+
build
4071
done
4172

4273
# Create repo files
43-
apt-ftparchive packages . > Packages
44-
apt-ftparchive release . > Release
74+
cd output && apt-ftparchive packages . > Packages && apt-ftparchive release . > Release

check.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

templates/DEBIAN/control

Lines changed: 0 additions & 14 deletions
This file was deleted.

templates/usr/bin/neovide

Lines changed: 0 additions & 2 deletions
This file was deleted.

templates/usr/share/applications/neovide.desktop

Lines changed: 0 additions & 9 deletions
This file was deleted.

templates/usr/share/doc/neovide/CHANGELOG.md

Lines changed: 0 additions & 2 deletions
This file was deleted.
-19 KB
Binary file not shown.

0 commit comments

Comments
 (0)