mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 16:19:37 +00:00
add AUR publish support
This commit is contained in:
121
.github/workflows/aur.yml
vendored
Normal file
121
.github/workflows/aur.yml
vendored
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
name: AUR Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-aur:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Derive version and checksum
|
||||||
|
id: meta
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
PKGVER="${GITHUB_REF_NAME#v}"
|
||||||
|
SRC_URL="https://github.com/dexoron/dcr/archive/refs/tags/v${PKGVER}.tar.gz"
|
||||||
|
SHA256="$(curl -fsSL "$SRC_URL" | sha256sum | awk '{print $1}')"
|
||||||
|
|
||||||
|
echo "pkgver=$PKGVER" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "source_url=$SRC_URL" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Render AUR metadata
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
PKGVER='${{ steps.meta.outputs.pkgver }}'
|
||||||
|
SRC_URL='${{ steps.meta.outputs.source_url }}'
|
||||||
|
SHA256='${{ steps.meta.outputs.sha256 }}'
|
||||||
|
|
||||||
|
cat > packaging/aur/dcr/PKGBUILD <<PKG
|
||||||
|
pkgname=dcr
|
||||||
|
pkgver=${PKGVER}
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Cargo-like utility to manage C/C++ projects"
|
||||||
|
arch=('x86_64' 'aarch64')
|
||||||
|
url="https://github.com/dexoron/dcr"
|
||||||
|
license=('MIT')
|
||||||
|
depends=('gcc-libs')
|
||||||
|
makedepends=('cargo')
|
||||||
|
optdepends=(
|
||||||
|
'gcc: build C/C++ projects with GCC'
|
||||||
|
'clang: build C/C++ projects with Clang'
|
||||||
|
)
|
||||||
|
source=("\$pkgname-\$pkgver.tar.gz::\$url/archive/refs/tags/v\$pkgver.tar.gz")
|
||||||
|
sha256sums=('${SHA256}')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "\$srcdir/\$pkgname-\$pkgver"
|
||||||
|
cargo build --release --locked
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "\$srcdir/\$pkgname-\$pkgver"
|
||||||
|
install -Dm755 "target/release/dcr" "\$pkgdir/usr/bin/dcr"
|
||||||
|
install -Dm644 LICENSE "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE"
|
||||||
|
}
|
||||||
|
PKG
|
||||||
|
|
||||||
|
cat > packaging/aur/dcr/.SRCINFO <<SRC
|
||||||
|
pkgbase = dcr
|
||||||
|
pkgdesc = Cargo-like utility to manage C/C++ projects
|
||||||
|
pkgver = ${PKGVER}
|
||||||
|
pkgrel = 1
|
||||||
|
url = https://github.com/dexoron/dcr
|
||||||
|
arch = x86_64
|
||||||
|
arch = aarch64
|
||||||
|
license = MIT
|
||||||
|
makedepends = cargo
|
||||||
|
depends = gcc-libs
|
||||||
|
optdepends = gcc: build C/C++ projects with GCC
|
||||||
|
optdepends = clang: build C/C++ projects with Clang
|
||||||
|
source = dcr-${PKGVER}.tar.gz::${SRC_URL}
|
||||||
|
sha256sums = ${SHA256}
|
||||||
|
|
||||||
|
pkgname = dcr
|
||||||
|
SRC
|
||||||
|
|
||||||
|
- name: Push to AUR
|
||||||
|
env:
|
||||||
|
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||||
|
AUR_PACKAGE: dcr
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ -z "${AUR_SSH_PRIVATE_KEY:-}" ]]; then
|
||||||
|
echo "AUR_SSH_PRIVATE_KEY secret is missing"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
install -d -m 700 ~/.ssh
|
||||||
|
printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/aur
|
||||||
|
chmod 600 ~/.ssh/aur
|
||||||
|
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
||||||
|
git clone "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git" aur-repo
|
||||||
|
cp packaging/aur/dcr/PKGBUILD aur-repo/PKGBUILD
|
||||||
|
cp packaging/aur/dcr/.SRCINFO aur-repo/.SRCINFO
|
||||||
|
|
||||||
|
cd aur-repo
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
if git diff --quiet; then
|
||||||
|
echo "No AUR changes"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add PKGBUILD .SRCINFO
|
||||||
|
git commit -m "dcr ${{ steps.meta.outputs.pkgver }}"
|
||||||
|
git push
|
||||||
21
packaging/aur/README.md
Normal file
21
packaging/aur/README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# AUR publishing
|
||||||
|
|
||||||
|
This repository includes an automated AUR publish workflow:
|
||||||
|
- package files: `packaging/aur/dcr/PKGBUILD`, `packaging/aur/dcr/.SRCINFO`
|
||||||
|
- workflow: `.github/workflows/aur.yml`
|
||||||
|
|
||||||
|
## One-time setup
|
||||||
|
|
||||||
|
1. Create the `dcr` package on AUR and initialize its git repository.
|
||||||
|
2. Create an SSH key pair for CI.
|
||||||
|
3. Add the public key to your AUR account.
|
||||||
|
4. Add the private key to GitHub Actions secret `AUR_SSH_PRIVATE_KEY`.
|
||||||
|
|
||||||
|
## Release flow
|
||||||
|
|
||||||
|
1. Bump project version in `Cargo.toml`.
|
||||||
|
2. Push tag `v<version>` (example: `v0.2.2`).
|
||||||
|
3. GitHub Actions will:
|
||||||
|
- compute source tarball SHA256
|
||||||
|
- render `PKGBUILD` and `.SRCINFO`
|
||||||
|
- push updates to `ssh://aur@aur.archlinux.org/dcr.git`
|
||||||
16
packaging/aur/dcr/.SRCINFO
Normal file
16
packaging/aur/dcr/.SRCINFO
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
pkgbase = dcr
|
||||||
|
pkgdesc = Cargo-like utility to manage C/C++ projects
|
||||||
|
pkgver = 0.2.1
|
||||||
|
pkgrel = 1
|
||||||
|
url = https://github.com/dexoron/dcr
|
||||||
|
arch = x86_64
|
||||||
|
arch = aarch64
|
||||||
|
license = MIT
|
||||||
|
makedepends = cargo
|
||||||
|
depends = gcc-libs
|
||||||
|
optdepends = gcc: build C/C++ projects with GCC
|
||||||
|
optdepends = clang: build C/C++ projects with Clang
|
||||||
|
source = dcr-0.2.1.tar.gz::https://github.com/dexoron/dcr/archive/refs/tags/v0.2.1.tar.gz
|
||||||
|
sha256sums = 30e334fa98cd51073c0fa84c80a982584b00156b57084311ad53419441ce6235
|
||||||
|
|
||||||
|
pkgname = dcr
|
||||||
26
packaging/aur/dcr/PKGBUILD
Normal file
26
packaging/aur/dcr/PKGBUILD
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
pkgname=dcr
|
||||||
|
pkgver=0.2.1
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Cargo-like utility to manage C/C++ projects"
|
||||||
|
arch=('x86_64' 'aarch64')
|
||||||
|
url="https://github.com/dexoron/dcr"
|
||||||
|
license=('MIT')
|
||||||
|
depends=('gcc-libs')
|
||||||
|
makedepends=('cargo')
|
||||||
|
optdepends=(
|
||||||
|
'gcc: build C/C++ projects with GCC'
|
||||||
|
'clang: build C/C++ projects with Clang'
|
||||||
|
)
|
||||||
|
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
|
||||||
|
sha256sums=('30e334fa98cd51073c0fa84c80a982584b00156b57084311ad53419441ce6235')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
cargo build --release --locked
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$srcdir/$pkgname-$pkgver"
|
||||||
|
install -Dm755 "target/release/dcr" "$pkgdir/usr/bin/dcr"
|
||||||
|
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user