--- name: makepkg description: Build Arch Linux Packages. author: Michael Sasser branding: icon: shield color: blue inputs: update_package_database: description: Download fresh package databases before building. required: false default: "true" update_checksum: description: Update the checksum before building the package. required: false default: "true" lint_pkgbuild: description: Run namecap on the PKGBUILD. required: false default: "true" install_package: description: Install the package after it was built. required: false default: "true" lint_package: description: Run namecap on the resulting package. required: false default: "true" outputs: package: description: "The name of the package file built by this action" value: ${{ steps.package.outputs.name }} runs: using: composite steps: - name: Update Package Database if: inputs.update_package_database == 'true' shell: bash run: | echo ::group::{Pacman Version} pacman --version echo ::endgroup:: echo ::group::{Pacman Update Package Database Output} sudo pacman -Sy --noconfirm echo ::endgroup:: - name: Update checksums if: inputs.update_checksum == 'true' shell: bash run: | echo ::group::{updpkgsums Version} updpkgsums --version echo ::endgroup:: echo ::group::{updpkgsums Output} updpkgsums echo ::endgroup:: - name: Download & Extract Packages shell: bash run: | echo ::group::{PKGBUILD File Content} cat PKGBUILD echo ::endgroup:: echo ::group::{makepkg Version} makepkg --version echo ::endgroup:: echo ::group::{Download and Extract Package Output} makepkg -so --noconfirm --needed echo ::endgroup:: echo ::group::{Source Directory Content} ls -la src/ echo ::endgroup:: - name: Lint PKGBUILD shell: bash if: inputs.lint_pkgbuild == 'true' run: | echo ::group::{Namcap Version} namcap --version echo ::endgroup:: echo ::group::{Lint Result - PKGBUILD} namcap PKGBUILD echo ::endgroup:: - name: Build shell: bash run: | echo ::group::{Build Output} if [ ${{ inputs.install_package }} = 'true' ]; then makepkg -si --skipchecksums --skippgpcheck --noconfirm --needed else makepkg -s --skipchecksums --skippgpcheck --noconfirm --needed fi echo ::endgroup:: echo ::group::{Directory Content After Build} ls -la echo ::endgroup:: - name: Lint Package(s) if: inputs.lint_package == 'true' shell: bash run: | echo ::group::{Lint Result - Package} namcap *.pkg.tar.zst echo ::endgroup:: # TODO: Check if there are pre-existing files that match this and exclude them there - name: Set Output id: package shell: bash run: | files=(*.pkg.tar.zst) if [[ "${#files[@]}" == 1 ]]; then echo "name=${files[0]}" >> $GITHUB_OUTPUT else echo "::error title=packages::The number of packages in the output is greater than 1." exit 1 fi