Skip to content

Commit

Permalink
ci: fix arch package build directory structure
Browse files Browse the repository at this point in the history
- Create proper source directory structure for makepkg
- Add -p flag to runuser to preserve env vars
- Add root group to nobody user for proper permissions
- Restore directory changes in PKGBUILD
  • Loading branch information
aljen committed Dec 1, 2024
1 parent e7bbabd commit ffb0e85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,15 @@ jobs:
run: |
VERSION=$(grep -m1 'version =' Cargo.toml | cut -d '"' -f2)
sed -i "s/pkgver=.*/pkgver=$VERSION/" dist/arch/PKGBUILD
cp dist/arch/PKGBUILD .
mkdir -p /tmp/pkg/src
cp -r . /tmp/pkg/src/modbus-relay
cp dist/arch/PKGBUILD /tmp/pkg
- name: Build package
run: |
cd /tmp/pkg
chown -R nobody:nobody .
runuser -u nobody -- makepkg -s --noconfirm
runuser -p -u nobody -g root -- makepkg -s --noconfirm
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
3 changes: 3 additions & 0 deletions dist/arch/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ makedepends=('cargo' 'git')
backup=('etc/modbus-relay/config.yaml')

build() {
cd "$srcdir/$pkgname"
cargo build --release
}

package() {
cd "$srcdir/$pkgname"

# Binary
install -Dm755 "target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"

Expand Down

0 comments on commit ffb0e85

Please sign in to comment.