arch-makepkg/action.yml

131 lines
3.3 KiB
YAML
Raw Normal View History

2024-12-27 11:25:43 +01:00
---
name: makepkg
description: Build Arch Linux Packages.
author: Michael Sasser <info@michaelsasser.org>
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"
2024-12-27 12:17:56 +01:00
outputs:
package:
description: "The name of the package file built by this action"
value: ${{ steps.package.outputs.name }}
2024-12-27 11:25:43 +01:00
runs:
using: composite
steps:
- name: Update Package Database
if: inputs.update_package_database == 'true'
shell: bash
run: |
2024-12-27 12:17:56 +01:00
echo ::group::{Pacman Version}
2024-12-27 11:25:43 +01:00
pacman --version
2024-12-27 12:17:56 +01:00
echo ::endgroup::
echo ::group::{Pacman Update Package Database Output}
2024-12-27 11:25:43 +01:00
sudo pacman -Sy --noconfirm
2024-12-27 12:17:56 +01:00
echo ::endgroup::
2024-12-27 11:25:43 +01:00
- name: Update checksums
if: inputs.update_checksum == 'true'
shell: bash
run: |
2024-12-27 12:17:56 +01:00
echo ::group::{updpkgsums Version}
2024-12-27 11:25:43 +01:00
updpkgsums --version
2024-12-27 12:17:56 +01:00
echo ::endgroup::
echo ::group::{updpkgsums Output}
2024-12-27 11:25:43 +01:00
updpkgsums
2024-12-27 12:17:56 +01:00
echo ::endgroup::
2024-12-27 11:25:43 +01:00
- name: Download & Extract Packages
shell: bash
run: |
2024-12-27 12:17:56 +01:00
echo ::group::{PKGBUILD File Content}
2024-12-27 11:25:43 +01:00
cat PKGBUILD
2024-12-27 12:17:56 +01:00
echo ::endgroup::
echo ::group::{makepkg Version}
2024-12-27 11:25:43 +01:00
makepkg --version
2024-12-27 12:17:56 +01:00
echo ::endgroup::
echo ::group::{Download and Extract Package Output}
2024-12-27 11:25:43 +01:00
makepkg -so --noconfirm --needed
2024-12-27 12:17:56 +01:00
echo ::endgroup::
echo ::group::{Source Directory Content}
2024-12-27 11:25:43 +01:00
ls -la src/
2024-12-27 12:17:56 +01:00
echo ::endgroup::
2024-12-27 11:25:43 +01:00
- name: Lint PKGBUILD
shell: bash
if: inputs.lint_pkgbuild == 'true'
run: |
2024-12-27 12:17:56 +01:00
echo ::group::{Namcap Version}
2024-12-27 11:25:43 +01:00
namcap --version
2024-12-27 12:17:56 +01:00
echo ::endgroup::
echo ::group::{Lint Result - PKGBUILD}
2024-12-27 11:25:43 +01:00
namcap PKGBUILD
2024-12-27 12:17:56 +01:00
echo ::endgroup::
2024-12-27 11:25:43 +01:00
- name: Build
shell: bash
run: |
2024-12-27 12:17:56 +01:00
echo ::group::{Build Output}
2024-12-27 11:25:43 +01:00
if [ ${{ inputs.install_package }} = 'true' ]; then
makepkg -si --skipchecksums --skippgpcheck --noconfirm --needed
else
makepkg -s --skipchecksums --skippgpcheck --noconfirm --needed
fi
2024-12-27 12:17:56 +01:00
echo ::endgroup::
echo ::group::{Directory Content After Build}
2024-12-27 11:25:43 +01:00
ls -la
2024-12-27 12:17:56 +01:00
echo ::endgroup::
2024-12-27 11:25:43 +01:00
- name: Lint Package(s)
if: inputs.lint_package == 'true'
shell: bash
2024-12-27 12:17:56 +01:00
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