Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arch User Repository (AUR) auto release #11309

Merged
merged 4 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/auto_aur_release_stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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: Extract package_file_name
id: get_package_file_name
run: echo ::set-output name=PACKAGE_FILE_NAME::siyuan-${{ steps.get_version_without_v.outputs.TAG_VERSION_WITHOUT_V }}-linux.AppImage

- 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>

pkgname=siyuan_stable
pkgver=${{ steps.get_version.outputs.TAG_VERSION }}
pkgrel=0
pkgdesc="auto upload to AUR when SiYuan stable release"
arch=("x86_64")
url="https://b3log.org/siyuan"
license=("AGPL-3.0-only")
_pkgname=${{ steps.get_package_file_name.outputs.PACKAGE_FILE_NAME }}
noextract=(${{ steps.get_package_file_name.outputs.PACKAGE_FILE_NAME }})
options=("!strip" "!debug")
depends=("fuse2")
optdepends=('pandoc: docx export')
source=("\${_pkgname}::https://github.com/siyuan-note/siyuan/releases/download/${{ steps.get_version.outputs.TAG_VERSION }}/${{ steps.get_package_file_name.outputs.PACKAGE_FILE_NAME }}")
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_stable+" "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_stable.png"
install -Dm644 "squashfs-root/siyuan.desktop" "\${pkgdir}/usr/share/applications/siyuan_stable.desktop"
}
EOF

- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@v2.7.1
with:
pkgname: siyuan_stable
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,dsa,ecdsa,ed25519
Loading