diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 00408f3..bd164a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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] @@ -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@ + 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 diff --git a/aur/PKGBUILD b/aur/PKGBUILD new file mode 100644 index 0000000..b46226c --- /dev/null +++ b/aur/PKGBUILD @@ -0,0 +1,50 @@ +# Maintainer: saying +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" +}