A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang. (PERSONAL FORK)
1name: Upload to AUR
2
3on:
4 release:
5 types: [published]
6
7jobs:
8 build:
9 runs-on: ubuntu-latest
10 steps:
11 - name: Check tag aka check release type
12 id: checktag
13 run: |
14 if [[ "${{ github.ref }}" == *"dev"* ]]; then
15 echo "Skip the workflow as the tag contains 'dev'"
16 echo "::set-output name=skip::true"
17 else
18 echo "Continue the workflow"
19 echo "::set-output name=skip::false"
20 fi
21 shell: bash
22
23 - name: Extract tag name
24 id: get_version
25 run: echo ::set-output name=TAG_VERSION::${{ github.event.release.tag_name }}
26
27 - name: Extra tag name without v
28 id: get_version_without_v
29 run: echo ::set-output name=TAG_VERSION_WITHOUT_V::$(echo "${{ github.event.release.tag_name }}" | sed 's/^v//')
30
31 - name: Create PKGBUILD
32 run: |
33 cat << EOF >> PKGBUILD
34 # maintainer: zxkmm (IHp4a21tQGhvdG1haWwuY29t)
35 # auto running on siyuan official repo
36 # PKGBUILD is modified from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=siyuan-appimage
37 # which is made by vvxxp8 <concatenate[g] the characters[x] in square[b] brackets[1] in[5] order[3] at gmail dot com>
38 # had agreement with the author to use the PKGBUILD
39 # for change request, PLEASE MAKE A PR ON GITHUB REPO, keep commenting here would be ignored
40
41 pkgname=siyuan-bin
42 pkgver=${{ steps.get_version_without_v.outputs.TAG_VERSION_WITHOUT_V }}
43 pkgrel=1
44 pkgdesc="auto upload to AUR when SiYuan stable release"
45 arch=("x86_64")
46 url="https://b3log.org/siyuan"
47 license=("AGPL-3.0-only")
48 options=("!strip" "!debug")
49 depends=("fuse2")
50 optdepends=('pandoc: docx export')
51 source=("https://github.com/siyuan-note/siyuan/releases/download/v\${pkgver}/siyuan-\${pkgver}-linux.AppImage")
52 sha256sums=('SKIP')
53
54 _pkgname=siyuan-\${pkgver}-linux.AppImage
55 noextract=("\${_pkgname}")
56
57 prepare() {
58 chmod +x "\${_pkgname}"
59 ./"\${_pkgname}" --appimage-extract > /dev/null
60 }
61
62 build() {
63 # Adjust .desktop so it will work autside of AppImage container
64 sed -i \\
65 -e "s|Exec=AppRun|Exec=/opt/\${pkgname}/\${pkgname}.AppImage|" \\
66 -e "s+^Icon=.*+Icon=siyuan-bin+" \\
67 "squashfs-root/siyuan.desktop"
68
69 # Fix permissions; .AppImage permissions are 700 for all directories
70 chmod -R a-x+rX squashfs-root/usr
71 }
72
73 package() {
74 # AppImage
75 install -Dm755 "\${srcdir}/\${_pkgname}" "\${pkgdir}/opt/\${pkgname}/\${pkgname}.AppImage"
76 install -Dm644 "\${srcdir}/squashfs-root/LICENSE" "\${pkgdir}/opt/\${pkgname}/LICENSE"
77
78 # Desktop file
79 install -Dm644 "\${srcdir}/squashfs-root/siyuan.desktop" \\
80 "\${pkgdir}/usr/share/applications/siyuan.desktop"
81
82 # Icon images
83 install -Dm644 "squashfs-root/resources/stage/icon.png" \\
84 "\${pkgdir}/usr/share/icons/hicolor/512x512/apps/siyuan-bin.png"
85
86 # Symlink executable
87 install -dm755 "\${pkgdir}/usr/bin"
88 ln -s "/opt/\${pkgname}/\${pkgname}.AppImage" "\${pkgdir}/usr/bin/siyuan"
89
90 # Symlink license
91 install -dm755 "\${pkgdir}/usr/share/licenses/\${pkgname}/"
92 ln -s "/opt/\${pkgname}/LICENSE" "\${pkgdir}/usr/share/licenses/\${pkgname}"
93 }
94 EOF
95
96 - name: Publish AUR package
97 uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
98 with:
99 pkgname: siyuan-bin
100 pkgbuild: ./PKGBUILD
101 commit_username: ${{ secrets.AUR_USERNAME }}
102 commit_email: ${{ secrets.AUR_EMAIL }}
103 ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
104 commit_message: Update AUR package
105 ssh_keyscan_types: rsa,ecdsa,ed25519