forked from siyuan-note/siyuan
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (77 loc) · 3.5 KB
/
auto_aur_release_stable.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Upload to AUR
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check tag aka check release type
id: checktag
run: |
if [[ "${{ github.ref }}" == *"dev"* ]]; then
echo "Skip the workflow as the tag contains 'dev'"
echo "::set-output name=skip::true"
else
echo "Continue the workflow"
echo "::set-output name=skip::false"
fi
shell: bash
- name: Extract tag name
id: get_version
run: echo ::set-output name=TAG_VERSION::${{ github.event.release.tag_name }}
- name: Extra tag name without v
id: get_version_without_v
run: echo ::set-output name=TAG_VERSION_WITHOUT_V::$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
- name: Create PKGBUILD
run: |
cat << EOF >> PKGBUILD
# maintainer: zxkmm (IHp4a21tQGhvdG1haWwuY29t)
# auto running on siyuan official repo
# PKGBUILD is modified from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=siyuan-appimage
# which is made by vvxxp8 <concatenate[g] the characters[x] in square[b] brackets[1] in[5] order[3] at gmail dot com>
# had agreement with the author to use the PKGBUILD
# for change request, PLEASE MAKE A PR ON GITHUB REPO, keep commenting here would be ignored
pkgname=siyuan-bin
pkgver=${{ steps.get_version_without_v.outputs.TAG_VERSION_WITHOUT_V }}
pkgrel=1
pkgdesc="auto upload to AUR when SiYuan stable release"
arch=("x86_64")
url="https://b3log.org/siyuan"
license=("AGPL-3.0-only")
_pkgname=siyuan-\${pkgver}-linux.AppImage
noextract=(siyuan-\${pkgver}-linux.AppImage)
options=("!strip" "!debug")
depends=("fuse2")
optdepends=('pandoc: docx export')
source=("https://github.com/siyuan-note/siyuan/releases/download/v\${pkgver}/siyuan-\${pkgver}-linux.AppImage")
sha256sums=('SKIP')
_installdir=/opt/appimages
prepare() {
chmod a+x \${_pkgname}
./\${_pkgname} --appimage-extract >/dev/null
sed -i "s+AppRun+\${_installdir}/siyuan.AppImage+" "squashfs-root/siyuan.desktop"
sed -i "s+^Icon=.*+Icon=siyuan-bin+" "squashfs-root/siyuan.desktop"
}
package() {
install -Dm755 \${_pkgname} "\${pkgdir}/\${_installdir}/siyuan.AppImage"
install -Dm644 "squashfs-root/resources/stage/icon.png" "\${pkgdir}/usr/share/icons/hicolor/512x512/apps/siyuan-bin.png"
install -Dm644 "squashfs-root/siyuan.desktop" "\${pkgdir}/usr/share/applications/siyuan-bin.desktop"
if [ ! -f "${pkgdir}/usr/bin/siyuan" ]; then
mkdir -p "${pkgdir}/usr/bin"
echo '#!/bin/sh' > "${pkgdir}/usr/bin/siyuan"
echo "exec ${_installdir}/siyuan.AppImage" >> "${pkgdir}/usr/bin/siyuan"
chmod 755 "${pkgdir}/usr/bin/siyuan"
fi
}
EOF
- name: Publish AUR package
uses: KSXGitHub/[email protected]
with:
pkgname: siyuan-bin
pkgbuild: ./PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Update AUR package
ssh_keyscan_types: rsa,ecdsa,ed25519