Skip to content

Commit

Permalink
ci(aur): add aur
Browse files Browse the repository at this point in the history
  • Loading branch information
saying121 committed May 18, 2024
1 parent ba30755 commit 0b981c9
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 46 deletions.
79 changes: 33 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
--allow-branch HEAD \
--no-confirm \
--workspace -x \
|| echo "No crates publish."
|| echo "Some crates not publish."
create-release:
# needs: [publish]
Expand Down Expand Up @@ -179,48 +179,35 @@ jobs:
# ref: refs/tags/${{ needs.get-version.outputs.tag_version }}
checksum: sha256

# - name: tar
# if: ${{ matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-unknown-linux-gnu' }}
# run: |
# cp ./target/x86_64-unknown-linux-gnu/release/lcode ./lcode
# tar -cvf lcode.tar ./lcode
#
# - uses: actions/upload-artifact@v4
# if: ${{ matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-unknown-linux-gnu' }}
# with:
# name: lcode.tar
# path: lcode.tar
#
# completions:
# runs-on: ubuntu-latest
# needs: [build]
# steps:
# - uses: actions/checkout/@v4
#
# - uses: actions/download-artifact@v4
# with:
# merge-multiple: true
#
# - name: Generate completions
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COMMIT_MSG: |
# completions(generated): update completions
# run: |
# tar -xvf lcode.tar
# # git checkout main
# ./lcode --generate=zsh >./completions/_lcode
# ./lcode --generate=bash >./completions/lcode.bash
# ./lcode --generate=fish >./completions/lcode.fish
#
# git config user.email "actions@github"
# git config user.name "Github Actions"
# git remote set-url origin https://x-access-token:"${GITHUB_TOKEN}"@github.com/"${GITHUB_REPOSITORY}".git
# git add completions/
#
# git tag
# git log 2
#
# echo "${GITHUB_REF}"
# # shellcheck disable=SC2015
# git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push --verbose)
aur-publish:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Fetch Repository
uses: actions/checkout@v4

- name: Build PKGBUILD
run: |
url="https://github.com/saying121/lcode/releases/download/%s/lcode-%s-%s-unknown-linux-gnu.sha256"
# shellcheck disable=SC2059
wget -O x86_64.txt "$(printf $url v0.9.1 v0.9.1 x86_64)"
# shellcheck disable=SC2059
wget -O aarch64.txt "$(printf $url v0.9.1 v0.9.1 aarch64)"
sha_x86_64=$(cut -d' ' -f1 <(cat x86_64.txt))
sha_aarch64=$(cut -d' ' -f1 <(cat aarch64.txt))
sed -i "s/^sha256sums_x86_64=.*/sha256sums_x86_64=\(\'$sha_x86_64\'\)/g" ./aur/PKGBUILD
sed -i "s/^sha256sums_aarch64=.*/sha256sums_aarch64=\(\'$sha_aarch64\'\)/g" ./aur/PKGBUILD
- name: Publish AUR package
uses: KSXGitHub/github-actions-deploy-aur@<TAG>
with:
pkgname: lcode-bin
pkgbuild: ./aur/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
50 changes: 50 additions & 0 deletions aur/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Maintainer: saying <saying121@outlook.com>
pkgname=lcode-bin
_binname=lcode
_repository=lcode
pkgver=v0.9.1
pkgrel=1
epoch=
pkgdesc="An application of terminal write leetcode."
arch=('x86_64' 'aarch64')
url="https://github.com/saying121/lcode"
license=('Apache-2.0')
depends=('dbus' 'sqlite' 'mdcat')
# makedepends=('jq' 'curl')
checkdepends=()
optdepends=('gnome-keyring')
provides=('lcode')
conflicts=()
replaces=()
groups=()
backup=()
options=()
install=
changelog=

source_x86_64=("https://github.com/saying121/${_repository}/releases/download/${pkgver}/${_binname}-${pkgver}-x86_64-unknown-linux-gnu.tar.gz")
sha256sums_x86_64=('ed6aab2b66d72ec65a15e1d6d1782d2eab47447d99d17d05cc11a1a5986a0aba')
source_aarch64=("https://github.com/saying121/${_repository}/releases/download/${pkgver}/${_binname}-${pkgver}-aarch64-unknown-linux-gnu.tar.gz")
sha256sums_aarch64=('9d56dcb687ef5beb89702365be419ea8fe45de6b9d7ea9c28506c81e940059fa')

noextract=()
validpgpkeys=()

# pkgver() {
# curl -s "https://api.github.com/repos/saying121/lcode/releases/latest" | jq '.tag_name'
# }

build() {
install -dm755 "completions"
./lcode --generate=zsh >completions/_${_binname}
./lcode --generate=bash >completions/${_binname}.bash
./lcode --generate=fish >completions/${_binname}.fish
}

package() {
install -Dm755 "./${_binname}" "${pkgdir}/usr/bin/${_binname}"

install -Dm644 completions/_${_binname} "${pkgdir}/usr/share/zsh/site-functions/_${_binname}"
install -Dm644 completions/${_binname}.bash "${pkgdir}/usr/share/bash-completion/completions/${_binname}"
install -Dm644 completions/${_binname}.fish "${pkgdir}/usr/share/fish/vendor_completions.d/${_binname}.fish"
}

0 comments on commit 0b981c9

Please sign in to comment.