Build and Upload Arch Package #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Upload Arch Package | |
on: | |
workflow_dispatch: | |
inputs: | |
repo: | |
description: 'Repository URL' | |
required: true | |
env: | |
TZ: Asia/Kolkata | |
jobs: | |
build-arch-package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Pull Arch Linux Docker image | |
run: docker pull alex5402/endeavouros:latest | |
- name: Build package for ${{ github.event.inputs.repo }} | |
run: | | |
docker run --rm \ | |
-v $(pwd):/workspace -w /workspace archlinux:latest bash -c " | |
echo 'Building Arch Linux package'; | |
pacman -Syu --noconfirm; | |
pacman -S base-devel git sudo --noconfirm; | |
# Create a non-root user | |
useradd -m builder; | |
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers; | |
# Ensure builder user has ownership of the workspace | |
chown -R builder /workspace; | |
# Switch to the non-root user | |
sudo -u builder bash -c ' | |
git config --global --add safe.directory /workspace; | |
git clone \"${{ github.event.inputs.repo }}\" source; | |
cd source; | |
makepkg -s --noconfirm; | |
cp *.pkg.tar.zst /workspace/; | |
' | |
" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-output | |
path: '*.pkg.tar.zst' |