Release prebuilt app bundle for binary package
Some checks failed
Release App / release-app (push) Has been cancelled
Some checks failed
Release App / release-app (push) Has been cancelled
This commit is contained in:
144
.gitea/workflows/release-app.yaml
Normal file
144
.gitea/workflows/release-app.yaml
Normal file
@@ -0,0 +1,144 @@
|
||||
name: Release App
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release-app:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RELEASE_TAG: latest
|
||||
ARCHIVE_NAME: shinoa-linux-x86_64.tar.gz
|
||||
CHECKSUM_NAME: shinoa-linux-x86_64.tar.gz.sha256
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
SUDO=sudo
|
||||
else
|
||||
SUDO=
|
||||
fi
|
||||
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
curl \
|
||||
git \
|
||||
gperf \
|
||||
jq \
|
||||
libssl-dev \
|
||||
patchelf \
|
||||
pkg-config \
|
||||
zlib1g-dev
|
||||
|
||||
- name: Build release bundle
|
||||
run: |
|
||||
set -euo pipefail
|
||||
rm -rf build dist
|
||||
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build build -j"$(nproc)"
|
||||
|
||||
install -dm755 dist/usr/bin dist/usr/lib dist/usr/share/doc/shinoa
|
||||
install -m755 build/shinoa dist/usr/bin/shinoa
|
||||
install -m755 build/_deps/tdlib-build/libtdjson.so.1.8.63 \
|
||||
dist/usr/lib/libtdjson.so.1.8.63
|
||||
ln -sf libtdjson.so.1.8.63 dist/usr/lib/libtdjson.so
|
||||
install -m644 README.md dist/usr/share/doc/shinoa/README.md
|
||||
|
||||
patchelf --remove-rpath dist/usr/bin/shinoa
|
||||
|
||||
tar -C dist -czf "$ARCHIVE_NAME" usr
|
||||
sha256sum "$ARCHIVE_NAME" > "$CHECKSUM_NAME"
|
||||
|
||||
- name: Create or update release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
api="${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}"
|
||||
commit_sha="${{ github.sha }}"
|
||||
release_json="$(mktemp)"
|
||||
body_file="$(mktemp)"
|
||||
|
||||
cat > "$body_file" <<EOF
|
||||
Automated rolling release for commit \`${commit_sha}\`.
|
||||
EOF
|
||||
|
||||
status="$(curl --silent --show-error \
|
||||
--output "$release_json" \
|
||||
--write-out "%{http_code}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"$api/releases/tags/$RELEASE_TAG")"
|
||||
|
||||
if [ "$status" = "200" ]; then
|
||||
release_id="$(jq -r '.id' "$release_json")"
|
||||
jq -r '.assets[]?.id' "$release_json" | while read -r asset_id; do
|
||||
[ -n "$asset_id" ] || continue
|
||||
curl --fail-with-body \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-X DELETE \
|
||||
"$api/releases/$release_id/assets/$asset_id"
|
||||
done
|
||||
curl --fail-with-body \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-X DELETE \
|
||||
"$api/releases/tags/$RELEASE_TAG"
|
||||
elif [ "$status" != "404" ]; then
|
||||
echo "Failed to query release, HTTP $status" >&2
|
||||
cat "$release_json" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
status="$(curl --silent --show-error \
|
||||
--output /dev/null \
|
||||
--write-out "%{http_code}" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-X DELETE \
|
||||
"$api/tags/$RELEASE_TAG")"
|
||||
case "$status" in
|
||||
204|404) ;;
|
||||
*)
|
||||
echo "Failed to delete tag $RELEASE_TAG, HTTP $status" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
curl --fail-with-body \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-X POST \
|
||||
-d @- \
|
||||
"$api/releases" > "$release_json" <<EOF
|
||||
{
|
||||
"body": $(jq -Rs . < "$body_file"),
|
||||
"draft": false,
|
||||
"name": "latest",
|
||||
"prerelease": true,
|
||||
"tag_name": "$RELEASE_TAG",
|
||||
"target_commitish": "$commit_sha"
|
||||
}
|
||||
EOF
|
||||
|
||||
release_id="$(jq -r '.id' "$release_json")"
|
||||
[ -n "$release_id" ] && [ "$release_id" != "null" ]
|
||||
|
||||
for file in "$ARCHIVE_NAME" "$CHECKSUM_NAME"; do
|
||||
curl --fail-with-body \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-F "attachment=@${file}" \
|
||||
"$api/releases/$release_id/assets?name=$(basename "$file")"
|
||||
done
|
||||
29
PKGBUILD
29
PKGBUILD
@@ -1,33 +1,18 @@
|
||||
pkgname=shinoa-git
|
||||
pkgver=r4.4910fb5
|
||||
pkgname=shinoa-bin
|
||||
pkgver=latest
|
||||
pkgrel=1
|
||||
pkgdesc='Minimal Telegram terminal client built with ncurses and TDLib'
|
||||
pkgdesc='Minimal Telegram terminal client built with ncurses and bundled TDLib'
|
||||
arch=('x86_64')
|
||||
url='https://git.mshq.dev/AxiFisk/shinoa'
|
||||
license=('custom:unknown')
|
||||
depends=('gcc-libs' 'glibc' 'ncurses' 'openssl' 'zlib')
|
||||
makedepends=('cmake' 'git' 'gperf')
|
||||
provides=('shinoa')
|
||||
conflicts=('shinoa')
|
||||
source=('git+https://git.mshq.dev/AxiFisk/shinoa.git')
|
||||
source=(
|
||||
"shinoa-linux-x86_64.tar.gz::${url}/releases/download/latest/shinoa-linux-x86_64.tar.gz"
|
||||
)
|
||||
sha256sums=('SKIP')
|
||||
|
||||
pkgver() {
|
||||
cd "$srcdir/shinoa"
|
||||
printf 'r%s.%s' "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
||||
}
|
||||
|
||||
build() {
|
||||
cmake -S "$srcdir/shinoa" -B "$srcdir/build" \
|
||||
-DCMAKE_BUILD_TYPE=None \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr
|
||||
cmake --build "$srcdir/build" -j"$(nproc)"
|
||||
}
|
||||
|
||||
package() {
|
||||
install -Dm755 "$srcdir/build/shinoa" "$pkgdir/usr/bin/shinoa"
|
||||
install -Dm755 "$srcdir/build/_deps/tdlib-build/libtdjson.so.1.8.63" \
|
||||
"$pkgdir/usr/lib/libtdjson.so.1.8.63"
|
||||
ln -sf libtdjson.so.1.8.63 "$pkgdir/usr/lib/libtdjson.so"
|
||||
install -Dm644 "$srcdir/shinoa/README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
|
||||
cp -a "$srcdir/usr" "$pkgdir/"
|
||||
}
|
||||
|
||||
@@ -61,6 +61,10 @@ which builds the latest upstream TDLib tag on Gitea Actions and publishes a bund
|
||||
archive plus checksum to the Gitea Generic Package Registry under the `tdlib` package.
|
||||
It also refreshes a `latest/tdlib-latest.json` manifest with the newest published version.
|
||||
|
||||
The repository also includes [`.gitea/workflows/release-app.yaml`](.gitea/workflows/release-app.yaml),
|
||||
which builds a rolling `latest` release asset containing `usr/bin/shinoa` and the bundled
|
||||
`usr/lib/libtdjson.so*`. The root `PKGBUILD` installs that prebuilt release as `shinoa-bin`.
|
||||
|
||||
## Keys
|
||||
|
||||
- `Up` / `Down`: move selection
|
||||
|
||||
Reference in New Issue
Block a user