Skip to content

Commit

Permalink
chore(ci): publish on AUR
Browse files Browse the repository at this point in the history
  • Loading branch information
numToStr committed Dec 24, 2021
1 parent bef4aa1 commit dd17edf
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 34 deletions.
42 changes: 42 additions & 0 deletions .aur/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Maintainer: {{AUTHOR}} <{{EMAIL}}>

pkgname={{NAME}}
pkgver={{VERSION}}
pkgrel=1
pkgdesc="{{DESC}}"
arch=('x86_64' 'aarch64' 'armv7')
url={{URL}}
license=('GPL')
provides=($pkgname)
conflicts=($pkgname)

source_x86_64=(
"$url/releases/download/$pkgver/$pkgname-$pkgver-x86_64-unknown-linux-gnu.tar.gz"
)
md5sums_x86_64=(SKIP)

source_armv7=(
"$url/releases/download/$pkgver/$pkgname-$pkgver-armv7-unknown-linux-gnueabihf.tar.gz"
)
md5sums_armv7=(SKIP)

source_aarch64=(
"$url/releases/download/$pkgver/$pkgname-$pkgver-aarch64-unknown-linux-gnu.tar.gz"
)
md5sums_aarch64=(SKIP)

package() {
case $CARCH in
x86_64 )
_output="$pkgname-$pkgver-x86_64-unknown-linux-gnu"
;;
armv7 )
_output="$pkgname-$pkgver-armv7-unknown-linux-gnueabihf"
;;
aarch64 )
_output="$pkgname-$pkgver-aarch64-unknown-linux-gnu"
;;
esac

install -Dm755 "${srcdir}/${_output}/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
}
66 changes: 34 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ jobs:
PKG_NAME: ${{ steps.vars.outputs.PKG_NAME }}
PKG_VERSION: ${{ steps.vars.outputs.PKG_VERSION }}
PKG_DESC: ${{ steps.vars.outputs.PKG_DESC }}
PKG_AUTHORS: ${{ steps.vars.outputs.PKG_AUTHORS }}
PKG_AUTHOR: ${{ steps.vars.outputs.PKG_AUTHOR }}
PKG_EMAIL: ${{ steps.vars.outputs.PKG_EMAIL }}
PKG_HOMEPAGE: ${{ steps.vars.outputs.PKG_HOMEPAGE }}
steps:
- name: Git Checkout
Expand All @@ -76,7 +77,8 @@ jobs:
echo ::set-output name=PKG_NAME::${PKG_NAME}
echo ::set-output name=PKG_BASENAME::${PKG_BASENAME}
echo ::set-output name=PKG_DESC::${PKG_DESC}
echo ::set-output name=PKG_AUTHORS::${PKG_AUTHORS}
echo ::set-output name=PKG_AUTHOR::$(echo $PKG_AUTHORS | awk '{print $1}')
echo ::set-output name=PKG_EMAIL::$(echo $PKG_AUTHORS | awk '{print $2}' | sed -e 's/[<>]//g')
echo ::set-output name=PKG_HOMEPAGE::${PKG_HOMEPAGE}
- name: Install Rust toolchain
Expand Down Expand Up @@ -170,33 +172,33 @@ jobs:
command: publish
args: --verbose --all-features --token ${{ secrets.CARGO_TOKEN }}

# publish_aur_package:
# name: Publish AUR package
# runs-on: ubuntu-latest
# timeout-minutes: 20
# if: startsWith(github.ref, 'refs/tags/')
# needs: build
# steps:
# - uses: actions/checkout@v2
#
# - name: Generate PKGBUILD
# id: gen_pkgbuild
# shell: bash
# run: |
# sed -i -e "s%{{AUTHOR}}%${AUTHOR}%g;" ./.aur/PKGBUILD
# sed -i -e "s%{{EMAIL}}%${EMAIL}%g;" ./.aur/PKGBUILD
# sed -i -e "s%{{NAME}}%${PROJECT_NAME}%g;" ./.aur/PKGBUILD
# sed -i -e "s%{{DESC}}%${PROJECT_DESC}%g;" ./.aur/PKGBUILD
# sed -i -e "s%{{VERSION}}%${VERSION}%g;" ./.aur/PKGBUILD
# sed -i -e "s%{{URL}}%${URL}%g;" ./.aur/PKGBUILD
# cat ./.aur/PKGBUILD
#
# - name: Publish to the AUR
# uses: KSXGitHub/github-actions-deploy-aur@v2
# with:
# pkgname: ${{ env.PROJECT_NAME }}
# pkgbuild: ./.aur/PKGBUILD
# commit_username: ${{ env.AUTHOR }}
# commit_email: ${{ env.EMAIL }}
# commit_message: ${{ steps.gen_pkgbuild.outputs.VERSION }}
# ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
publish_aur_package:
name: Publish AUR package
runs-on: ubuntu-latest
timeout-minutes: 20
if: startsWith(github.ref, 'refs/tags/')
needs: build
steps:
- uses: actions/checkout@v2

- name: Generate PKGBUILD
id: gen_pkgbuild
shell: bash
run: |
sed -i -e "s%{{AUTHOR}}%${{needs.build.outputs.PKG_AUTHOR}}%g;" ./.aur/PKGBUILD
sed -i -e "s%{{EMAIL}}%${{needs.build.outputs.PKG_EMAIL}}%g;" ./.aur/PKGBUILD
sed -i -e "s%{{NAME}}%${{needs.build.outputs.PKG_NAME}}%g;" ./.aur/PKGBUILD
sed -i -e "s%{{DESC}}%${{needs.build.outputs.PKG_DESC}}%g;" ./.aur/PKGBUILD
sed -i -e "s%{{VERSION}}%${{needs.build.outputs.PKG_VERSION}}%g;" ./.aur/PKGBUILD
sed -i -e "s%{{URL}}%${{needs.build.outputs.PKG_HOMEPAGE}}%g;" ./.aur/PKGBUILD
cat ./.aur/PKGBUILD
- name: Publish to the AUR
uses: KSXGitHub/github-actions-deploy-aur@v2.2.5
with:
pkgbuild: ./.aur/PKGBUILD
pkgname: ${{ needs.build.outputs.PKG_NAME }}
commit_username: ${{ needs.build.outputs.PKG_AUTHOR }}
commit_email: ${{ needs.build.outputs.PKG_EMAIL }}
commit_message: ${{ needs.build.outputs.PKG_VERSION }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version = "0.7.1"
description = "Dotenv (.env) loader written in rust"
authors = ["numToStr <sudo@vikasraj.dev>"]
edition = "2018"
homepage = "https://github.com/numToStr/zenv/"
repository = "https://github.com/numToStr/zenv/"
homepage = "https://github.com/numToStr/zenv"
repository = "https://github.com/numToStr/zenv"
license = "GPL-3.0-or-later"
readme = "README.md"
keywords = ["env", "environment", "dotenv", "config", "cli"]
Expand Down

0 comments on commit dd17edf

Please sign in to comment.