### Example Error Output Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md This is an example of an actual error message displayed when a required input, such as 'inputs.pkgname', is found to be empty. ```bash ::error::Invalid Value: inputs.pkgname is empty. ``` -------------------------------- ### Example Fix for Empty Input Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md This example demonstrates the correct way to provide a value for the 'commit_username' input, contrasting a wrong approach with an empty string to a correct approach using a GitHub secret. ```yaml # ❌ Wrong - empty value commit_username: '' # ✅ Correct - using secret commit_username: ${{ secrets.AUR_USERNAME }} ``` -------------------------------- ### Makepkg Build Fails (Compilation Error) Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Example of a makepkg build failure due to a compilation error. This may require fixing the PKGBUILD, source code, or build dependencies. ```bash [user@host src]$ make ... error: ... make: *** [...] Error 1 ==> ERROR: A failure occurred in build(). ``` -------------------------------- ### Example Fix for force_push Input Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Presents incorrect and correct YAML configurations for the 'force_push' input, highlighting the requirement for string values 'true' or 'false'. ```yaml force_push: yes force_push: 'false' ``` -------------------------------- ### Makepkg Build Fails (Missing Dependencies) Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Indicates a makepkg build failure due to unresolved dependencies. Ensure all build dependencies are correctly listed in the PKGBUILD. ```bash ==> ERROR: Could not resolve all dependencies. ``` -------------------------------- ### Command Not Found Error Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Illustrates a 'command not found' error, often due to missing packages, typos, or incorrect PATH configuration. ```bash bash: command-not-found: command not found ``` -------------------------------- ### Example Usage of force_push Input Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Illustrates how to set the 'force_push' input in a YAML configuration. The default 'false' performs a normal push, while 'true' enables force pushing. ```yaml force_push: 'false' # Normal push (default) force_push: 'true' # Force push (use carefully) ``` -------------------------------- ### Shell Environment Setup: Set Home Directory Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md Explicitly sets the HOME environment variable for the builder user. This ensures the `.ssh` directory is created in the expected location. ```bash export HOME=/home/builder ``` -------------------------------- ### GitHub Actions Workflow Usage Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/action-inputs.md This snippet demonstrates how to use the KSXGitHub/github-actions-deploy-aur action in a GitHub Actions workflow, specifying various input parameters. ```yaml uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-awesome-package pkgbuild: ./PKGBUILD assets: | ./LICENSE ./additional-files/* updpkgsums: 'true' test: 'true' test_flags: '--clean --cleanbuild --nodeps --nosign' post_process: 'ls -la PKGBUILD' commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: 'Update version to v2.0' allow_empty_commits: 'false' force_push: 'false' ssh_keyscan_types: 'rsa,ecdsa,ed25519' ``` -------------------------------- ### Example GitHub Actions Workflow for AUR Package Publishing Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/README.md This snippet shows a complete GitHub Actions workflow that checks out code, generates a PKGBUILD, and then uses the KSXGitHub/github-actions-deploy-aur action to publish the package to AUR. Ensure you replace `` with the actual tag of the repository and configure the necessary secrets. ```yaml name: aur-publish on: push: tags: - '*' jobs: aur-publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Generate PKGBUILD run: bash ./generate-pkgbuild.bash - name: Publish AUR package uses: KSXGitHub/github-actions-deploy-aur@ with: pkgname: my-awesome-package pkgbuild: ./PKGBUILD commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: Update AUR package ssh_keyscan_types: rsa,ecdsa,ed25519 ``` -------------------------------- ### Example Error Output for force_push Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Demonstrates the error message format when the 'force_push' input is not a valid boolean string ('true' or 'false'). ```bash ::error::Invalid Value: inputs.force_push is neither 'true' nor 'false': 'maybe' ``` -------------------------------- ### File Not Found Error Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Shows a 'file not found' error, typically when a specified file path does not exist. Verify the path and ensure the file was generated by prior steps. ```bash cp: cannot stat '.../PKGBUILD': No such file or directory ``` -------------------------------- ### Example Fix for allow_empty_commits Input Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Shows incorrect and correct YAML configurations for the 'allow_empty_commits' input, emphasizing the need for string values 'true' or 'false'. ```yaml allow_empty_commits: true allow_empty_commits: 'yes' allow_empty_commits: 'true' ``` -------------------------------- ### Example Error Output for allow_empty_commits Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Illustrates the error message format when the 'allow_empty_commits' input is not a valid boolean string ('true' or 'false'). ```bash ::error::Invalid Value: inputs.allow_empty_commits is neither 'true' nor 'false': 'yes' ``` -------------------------------- ### Git Push Fails (SSH Authentication) Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Illustrates a Git push failure due to SSH authentication issues. Verify SSH key validity, access rights, configuration, and network connectivity. ```bash fatal: Could not read from remote repository. Please make sure you have the right access rights... ``` -------------------------------- ### Git Clone Fails (HTTPS) Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Example of a Git clone failure over HTTPS. This usually indicates an invalid package name, as HTTPS cloning does not require authentication. ```bash fatal: could not read Username for 'https://aur.archlinux.org': ... ``` -------------------------------- ### Set Container Entrypoint Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md Defines the entry point for the Docker container, which is the entrypoint.sh script. This script handles user creation, SSH setup, and execution of the main build script. ```dockerfile ENTRYPOINT ["/entrypoint.sh"] ``` -------------------------------- ### Install Build Dependencies in Docker Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md Installs necessary packages for building AUR packages within the Docker container. This includes essential build tools, Git, and SSH utilities. ```dockerfile RUN pacman -Syu --noconfirm RUN pacman -S --noconfirm --needed --overwrite '*' openssh sudo base-devel git fakeroot binutils gcc awk binutils xz libarchive bzip2 coreutils file findutils gettext grep gzip sed ncurses util-linux pacman-contrib debugedit ``` -------------------------------- ### Set Base Docker Image Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md Specifies the base Docker image to use for the build environment. This example uses the latest Arch Linux base image. ```dockerfile FROM archlinux:base ``` -------------------------------- ### Makepkg Checksums Fail Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Shows a makepkg checksum failure, meaning source file checksums do not match the PKGBUILD. Use `updpkgsums` to automatically fix checksums. ```bash ==> ERROR: One or more files did not pass the validity check! ``` -------------------------------- ### SSH Public Key Extraction Fails Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Illustrates an SSH public key extraction failure, typically because the key file is missing or malformed. Verify the `ssh_private_key` input is complete. ```bash ssh-keygen: No such file or directory ``` -------------------------------- ### SSH Host Key Verification Failure Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Shows a 'Host key verification failed' error. This occurs when `aur.archlinux.org` is not in `known_hosts`. Ensure host key types are included and network connectivity is stable. ```bash Host key verification failed. ``` -------------------------------- ### Get AUR SSH Private Key Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md Demonstrates how to retrieve your SSH private key for AUR access. Ensure this key is added as a GitHub secret. ```bash cat ~/.ssh/aur_key ``` -------------------------------- ### Example Error Message Format Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md This snippet shows the format for error messages related to invalid input values. It is used to inform the user about which input is empty and requires attention. ```bash ::error::Invalid Value: {input_name} is empty. ``` -------------------------------- ### Git Push Fails (Remote Diverged) Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Shows a Git push failure where the remote repository has diverged from the local one. Ensure the latest changes are pulled or consider a force push if appropriate. ```bash error: failed to push some refs to 'ssh://aur@aur.archlinux.org/.' hint: Updates were rejected because the remote contains work... ``` -------------------------------- ### Initialize SSH Directory Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Sets up the SSH directory for the builder user, including creating the directory, initializing known_hosts, copying SSH configuration, and setting appropriate ownership and permissions. This is part of the entrypoint initialization. ```bash mkdir -pv /home/builder/.ssh touch /home/builder/.ssh/known_hosts cp -v /ssh_config /home/builder/.ssh/config chown -vR builder:builder /home/builder chmod -vR 600 /home/builder/.ssh/* ``` -------------------------------- ### Create SSH directory and set permissions Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/functions-and-utilities.md Sets up the builder user's SSH directory, ensuring correct permissions for security. The -p option creates parent directories if they don't exist. ```bash mkdir -pv /home/builder/.ssh chmod -vR 600 /home/builder/.ssh/* chown -vR builder:builder /home/builder ``` -------------------------------- ### SSH Invalid Key Format Error Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Example of an 'Unencrypted private keys are not allowed' error. Ensure the private key is in OpenSSH format and is not encrypted. ```bash Unencrypted private keys are not allowed ``` -------------------------------- ### Create Builder User Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Creates a non-root user named 'builder' with a home directory, sets their shell to bash, disables password login, and grants passwordless sudo access. This is the first step in the entrypoint initialization. ```bash useradd --create-home --shell /bin/bash builder passwd --delete builder mkdir -p /etc/sudoers.d/ echo "builder ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/builder ``` -------------------------------- ### Copy PKGBUILD and Assets Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Copies the PKGBUILD file into the cloned repository. If additional assets are provided, they are also copied recursively into the repository directory. Hidden files are excluded by default. ```bash cp -v "$pkgbuild" /tmp/local-repo/PKGBUILD if [[ -n "$assets" ]]; then cp -rvt /tmp/local-repo/ $assets fi ``` -------------------------------- ### Test AUR Deployment Locally with Docker Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/README.md Build a Docker image and run a container to test your AUR deployment locally. Mount your current directory and set necessary environment variables. ```bash docker build -t test-aur-deploy . docker run \ -e INPUT_PKGNAME=test \ -e INPUT_PKGBUILD=./PKGBUILD \ -e INPUT_COMMIT_USERNAME=test \ -e INPUT_COMMIT_EMAIL=test@example.com \ -e INPUT_SSH_PRIVATE_KEY="$(cat key)" \ -v "$(pwd)":/workspace \ -w /workspace \ test-aur-deploy ``` -------------------------------- ### Create System User with useradd Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/functions-and-utilities.md Creates a new system user named 'builder' with a home directory and sets the default shell to bash. This user is typically used for build processes. ```bash useradd --create-home --shell /bin/bash builder ``` -------------------------------- ### Configure PKGBUILD Testing and Post-processing Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md YAML configuration for testing specific PKGBUILD features within the deployment workflow. Includes options for updating checksums, running build tests, and defining custom post-processing commands. ```yaml # Test checksum updates updpkgsums: 'true' # Test build process test: 'true' test_flags: '--clean --cleanbuild --nodeps' # Test post-processing post_process: 'echo "Checksums: "; grep sha256sum= PKGBUILD | head -1' ``` -------------------------------- ### Build, Release Binary, and Update AUR Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md This workflow builds an executable, releases it to GitHub, and then updates an AUR binary package. It requires build scripts and a PKGBUILD generator for binary packages. ```yaml name: Build, Release, and Deploy to AUR on: push: tags: - 'v*' jobs: build-and-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build executable run: | mkdir -p ./dist ./scripts/build.sh --output ./dist/my-app - name: Create GitHub Release uses: softprops/action-gh-release@v1 with: files: ./dist/my-app env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Generate PKGBUILD for binary package run: | bash ./scripts/generate-pkgbuild-bin.sh \ --version "${{ github.ref_name }}" \ --output ./PKGBUILD.bin - name: Publish binary package to AUR uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-awesome-package-bin pkgbuild: ./PKGBUILD.bin updpkgsums: 'true' test: 'true' commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: 'Release binary package v${{ github.ref_name }}' - name: Generate PKGBUILD for source package run: | bash ./scripts/generate-pkgbuild-src.sh \ --version "${{ github.ref_name }}" \ --output ./PKGBUILD.src - name: Publish source package to AUR uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-awesome-package pkgbuild: ./PKGBUILD.src updpkgsums: 'true' test: 'true' commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: 'Release source package v${{ github.ref_name }}' ``` -------------------------------- ### Input: pkgbuild Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md The relative or absolute path to the PKGBUILD file. This input is required and the file must be generated or provided before the action runs. ```APIDOC ## Input: pkgbuild ### Description Relative or absolute path to the PKGBUILD file. This file should be generated or provided before the action runs. ### Type string ### Required Yes ### Environment Variable `INPUT_PKGBUILD` ### Example ```yaml pkgbuild: ./PKGBUILD pkgbuild: ./build/PKGBUILD ``` ``` -------------------------------- ### Conditional Package Building with makepkg Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Runs the makepkg command to build a package if the 'test' input is set to 'true'. It navigates to the temporary local repository directory before building. Default flags include --clean, --cleanbuild, and --nodeps. ```bash if [ "$test" == "true" ]; then cd /tmp/local-repo/ makepkg "${test_flags[@]}" fi ``` -------------------------------- ### Undefined Variable Error Example Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Indicates an 'unbound variable' error, meaning a GitHub Actions input variable was not provided. Ensure input names match 'action.yml' and workflow usage. ```bash bash: INPUT_PKGNAME: unbound variable ``` -------------------------------- ### Example Usage of ssh_keyscan_types Input Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Demonstrates setting the 'ssh_keyscan_types' input in YAML. You can specify a comma-separated list of SSH key types to scan, such as all types, only ED25519, or a combination like RSA and ED25519. ```yaml ssh_keyscan_types: 'rsa,ecdsa,ed25519' # All types (default) ssh_keyscan_types: 'ed25519' # Only ED25519 ssh_keyscan_types: 'rsa,ed25519' # RSA and ED25519 ``` -------------------------------- ### Shell Environment Setup: Glob Ignore Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md Sets the GLOBIGNORE shell variable to prevent bash from expanding glob patterns to include '.' and '..'. This is crucial for correctly handling the 'assets' glob patterns. ```bash GLOBIGNORE=".:.." ``` -------------------------------- ### Test-build package with makepkg Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Enable this input to perform a test build of the package using makepkg. The action will exit with an error if the build fails. It only runs if the value is exactly 'true'. ```yaml test: 'true' # Test build the package test: 'false' # Skip (default) ``` -------------------------------- ### Minimal GitHub Actions Workflow Configuration Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md Use this minimal configuration for basic AUR package deployment. Ensure AUR_USERNAME, AUR_EMAIL, and AUR_SSH_PRIVATE_KEY secrets are set. ```yaml uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-package pkgbuild: ./PKGBUILD commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} ``` -------------------------------- ### Git Add Command Based on Assets Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Stages files for Git commit. If 'assets' is empty, it stages PKGBUILD and .SRCINFO. Otherwise, it stages all changes using 'git add --all'. ```bash if [[ -z "$assets" ]]; then git add -fv PKGBUILD .SRCINFO else git add --all fi ``` -------------------------------- ### Generate .SRCINFO Metadata Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md This command generates the required .SRCINFO file, which contains package metadata. It always runs regardless of configuration. ```bash makepkg --printsrcinfo >.SRCINFO ``` -------------------------------- ### Testing Deployment Locally with Docker Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Build and run the deployment action within a Docker container for local testing before deploying to production. This allows for isolated testing of the build and deployment process. ```bash docker build -t aur-deploy . docker run -e INPUT_PKGNAME=test ... aur-deploy ``` -------------------------------- ### Copy Build Scripts and Config to Docker Image Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md Copies the entrypoint script, build script, and SSH configuration file into the Docker image. These files are crucial for the build and deployment process. ```dockerfile COPY entrypoint.sh /entrypoint.sh COPY build.sh /build.sh COPY ssh_config /ssh_config ``` -------------------------------- ### Deploy Multiple Packages using Matrix Strategy Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/README.md Utilize GitHub Actions matrix strategy to deploy multiple packages concurrently. Define packages in the matrix and set max parallel jobs. ```yaml strategy: matrix: package: ['pkg1', 'pkg2', 'pkg3'] max-parallel: 3 with: pkgname: ${{ matrix.package }} ``` -------------------------------- ### Input: pkgname Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md The AUR package name. This input is required and is used to construct the git repository URL for the AUR package. ```APIDOC ## Input: pkgname ### Description AUR package name. This value is used to construct the git repository URL: `https://aur.archlinux.org/{pkgname}.git` ### Type string ### Required Yes ### Environment Variable `INPUT_PKGNAME` ### Example ```yaml pkgname: my-awesome-package ``` ``` -------------------------------- ### Generate PKGBUILD Before Deploy Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md If the PKGBUILD is not found, generate it before calling the deploy action. This ensures the action has the necessary file to proceed. ```yaml - name: Generate PKGBUILD run: bash ./generate-pkgbuild.sh - name: Publish to AUR uses: KSXGitHub/github-actions-deploy-aur@v1 ``` -------------------------------- ### PKGBUILD File Path Input Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Defines the 'pkgbuild' input, a required string representing the path to the PKGBUILD file. This file must exist and is copied into the action's local repository. ```yaml pkgbuild: ./PKGBUILD pkgbuild: ./build/PKGBUILD ``` -------------------------------- ### Copy PKGBUILD file Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/functions-and-utilities.md Copies the PKGBUILD file to the local repository directory. Use this for single file transfers. ```bash cp -v "$pkgbuild" /tmp/local-repo/PKGBUILD ``` -------------------------------- ### Execute Main Script as Builder User Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Executes the main build script (/build.sh) as the 'builder' user using a login shell. This command replaces the current process, ensuring that the build script runs with the correct user context. ```bash exec runuser -u builder -- bash -l /build.sh ``` -------------------------------- ### Local Docker Testing Script for AUR Deploy Action Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md A bash script to build a Docker image for testing the AUR deployment action locally. It runs the container with various environment variables simulating action inputs and mounts the current directory. ```bash #!/bin/bash # scripts/test-aur-action.sh # Build the Docker image docker build -t test-aur-deploy . # Run with test inputs docker run \ -e INPUT_PKGNAME=test-package \ -e INPUT_PKGBUILD=./PKGBUILD \ -e INPUT_COMMIT_USERNAME=test \ -e INPUT_COMMIT_EMAIL=test@example.com \ -e INPUT_SSH_PRIVATE_KEY="$(cat ~/.ssh/id_ed25519)" \ -e INPUT_TEST=true \ -e INPUT_UPDPKGSUMS=true \ -v "$(pwd)":/workspace \ -w /workspace \ test-aur-deploy ``` -------------------------------- ### Generate PKGBUILD and Publish to AUR Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md This workflow dynamically generates the PKGBUILD file before publishing the AUR package. It uses a script to create the PKGBUILD based on the Git tag version. ```yaml name: Build and Publish AUR on: push: tags: - 'v*' jobs: build-aur: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Generate PKGBUILD run: | bash ./scripts/generate-pkgbuild.sh \ --version "${{ github.ref_name }}" \ --output ./PKGBUILD - name: Publish AUR package uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-awesome-package pkgbuild: ./PKGBUILD commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: 'Update to ${{ github.ref_name }}' ``` -------------------------------- ### Full GitHub Actions Workflow Configuration Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/configuration.md This comprehensive configuration includes advanced options for assets, testing, custom commit messages, and push behavior. Ensure necessary secrets are configured. ```yaml uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-package pkgbuild: ./PKGBUILD assets: | ./LICENSE ./additional-files/* updpkgsums: 'true' test: 'true' test_flags: '--clean --cleanbuild --nodeps --nosign' post_process: 'echo "Post-processing complete" && ls -la' commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: 'Update to version ${{ github.ref }}' allow_empty_commits: 'false' force_push: 'false' ssh_keyscan_types: 'rsa,ecdsa,ed25519' ``` -------------------------------- ### Build Arch Linux Package with makepkg Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/functions-and-utilities.md Builds an Arch Linux package using makepkg. Can be used for testing with custom flags or for generating package metadata without a full build. ```bash makepkg "${test_flags[@]}" ``` ```bash makepkg --printsrcinfo >.SRCINFO ``` -------------------------------- ### Generate PKGBUILD Script Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md A bash script to generate a PKGBUILD file with version and output path as arguments. It uses a heredoc to define the PKGBUILD content and sed to replace version placeholders. ```bash #!/bin/bash # scripts/generate-pkgbuild.sh VERSION="${1:-0.1.0}" OUTPUT="${2:-./PKGBUILD}" cat > "$OUTPUT" << 'EOF' # Maintainer: Your Name pkgname=my-awesome-package pkgver=VERSION_PLACEHOLDER pkgrel=1 pkgdesc="A brief description" arch=('x86_64') url="https://github.com/yourusername/project" license=('MIT') makedepends=('gcc' 'make') depends=() source=("${pkgname}-${pkgver}.tar.gz::https://github.com/yourusername/project/archive/refs/tags/v${pkgver}.tar.gz") sha256sums=('PLACEHOLDER') build() { cd "${pkgname}-${pkgver}" make } package() { cd "${pkgname}-${pkgver}" make DESTDIR="$pkgdir" install install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } EOF # Replace placeholders sed -i "s/VERSION_PLACEHOLDER/$VERSION/" "$OUTPUT" ``` -------------------------------- ### Full-Featured AUR Deployment with Testing and Assets Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md An advanced workflow that includes build testing, copying additional assets, and generating checksums before publishing to AUR. It allows for custom commit messages and fine-grained control over the push process. ```yaml name: Full AUR Deployment on: push: tags: - 'v*' jobs: deploy-aur: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up build environment run: | mkdir -p ./build # Generate or copy build artifacts here - name: Generate PKGBUILD run: | bash ./scripts/generate-pkgbuild.sh \ --version "${{ github.ref_name }}" \ --output ./build/PKGBUILD - name: Copy additional assets run: | cp LICENSE ./build/LICENSE cp README.md ./build/README.md - name: Publish to AUR with testing uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-awesome-package pkgbuild: ./build/PKGBUILD assets: | ./build/LICENSE ./build/README.md ./build/additional-files/* updpkgsums: 'true' test: 'true' test_flags: '--clean --cleanbuild --nodeps' post_process: 'echo "Build successful" && ls -la' commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: 'Release ${{ github.ref_name }}' allow_empty_commits: 'false' force_push: 'false' ssh_keyscan_types: 'rsa,ecdsa,ed25519' ``` -------------------------------- ### Minimal GitHub Actions Workflow for AUR Deployment Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/README.md This is a basic workflow that triggers on tag pushes and uses the deploy-aur action to publish a package. Ensure your secrets are configured in GitHub. ```yaml name: Publish to AUR on: push: tags: ['v*'] jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-package pkgbuild: ./PKGBUILD commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} ``` -------------------------------- ### Parallel Deployments with GitHub Actions Matrix Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md Utilize GitHub Actions matrix strategy to run multiple package deployments in parallel for monorepos. This enhances performance by allowing up to `max-parallel` jobs to run concurrently. ```yaml strategy: matrix: package: ['package1', 'package2', 'package3'] max-parallel: 3 ``` -------------------------------- ### Project Source Code Layout Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/README.md Illustrates the directory structure of the GitHub Actions Deploy AUR project, highlighting the purpose of each file. ```text github-actions-deploy-aur/ ├── action.yml → GitHub Actions metadata ├── Dockerfile → Container image ├── entrypoint.sh → Docker entrypoint ├── build.sh → Main deployment script ├── ssh_config → SSH configuration ├── LICENSE.md → MIT license └── README.md → User documentation ``` -------------------------------- ### Write SSH Private Key to File Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Writes the provided SSH private key to a file in the user's home directory. Permissions are set to 600 for security. ```bash echo "$ssh_private_key" >~/.ssh/aur chmod -vR 600 ~/.ssh/aur* ``` -------------------------------- ### Optional Inputs for AUR Deployment Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/README.md These optional inputs allow for customization of the deployment process, such as updating checksums, testing the build, or including additional assets. ```yaml updpkgsums: 'true' # Update checksums test: 'true' # Test build assets: | ./LICENSE ./README.md ``` -------------------------------- ### Import SSH Private Key Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Imports the provided SSH private key into the '~/.ssh/' directory, sets restrictive permissions (600), and extracts the corresponding public key. This prepares the SSH key for authentication with AUR. ```bash echo "$ssh_private_key" >~/.ssh/aur chmod -vR 600 ~/.ssh/aur* ssh-keygen -vy -f ~/.ssh/aur >~/.ssh/aur.pub ``` -------------------------------- ### API Reference Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/INDEX.txt This section details the API surface of the GitHub Actions Deploy AUR, including input parameters, outputs, and internal functions available for integration. ```APIDOC ## API Surface Overview This GitHub Action provides a set of input parameters to configure the AUR deployment process. While there are no direct output parameters exposed, results are typically communicated through Git operations. ### Inputs The following input parameters are available for configuring the action: - **`pkgname`** (string) - Required - The name of the package to build and deploy. - **`pkgver`** (string) - Optional - The version of the package. If not provided, it will be inferred. - **`pkgrel`** (string) - Optional - The release number of the package. If not provided, it will be inferred. - **`commit_message`** (string) - Optional - The commit message to use for the AUR commit. - **`commit_author`** (string) - Optional - The author of the commit. - **`git_email`** (string) - Optional - The email address to use for Git commits. - **`git_name`** (string) - Optional - The name to use for Git commits. - **`gpg_key`** (string) - Required - The GPG key to sign the package with. - **`gpg_passphrase`** (string) - Required - The passphrase for the GPG key. - **`ssh_key`** (string) - Required - The SSH private key for pushing to the AUR repository. - **`ssh_known_hosts`** (string) - Optional - The content of the `known_hosts` file. - **`aur_url`** (string) - Optional - The URL of the AUR repository. - **`build_dir`** (string) - Optional - The directory to use for building the package. - **`skip_push`** (boolean) - Optional - If true, the action will not push the changes to the AUR repository. ### Internal Functions - **`assert_non_empty`**: A shell function used internally to validate that a given variable is not empty. This function is part of the utility set for ensuring script integrity. ### Error Handling The action defines four major error conditions that are handled to ensure robust deployment: 1. **Validation Errors**: Occur when required input parameters are missing or invalid. 2. **Build Errors**: Occur during the package build process (e.g., `makepkg` failures). 3. **Authentication Errors**: Occur due to issues with GPG keys or SSH keys. 4. **Push Errors**: Occur when pushing the changes to the AUR repository fails. Detailed information on error codes and recovery can be found in `errors-and-exit-codes.md`. ``` -------------------------------- ### Extract Version from Tag and Update PKGBUILD Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md Automate version management by extracting the version number from a Git tag (removing a leading 'v') and then updating the `pkgver` field in the `PKGBUILD` file using `sed`. ```yaml - name: Extract version run: | VERSION="${{ github.ref_name }}" echo "VERSION=${VERSION#v}" >> $GITHUB_ENV ``` ```yaml - name: Update PKGBUILD version run: | sed -i "s/pkgver=.*/pkgver=${{ env.VERSION }}/" ./PKGBUILD ``` -------------------------------- ### Specify Assets for Commit Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md To avoid 'Empty commit not allowed' errors when no changes are detected, ensure that the 'assets' input lists all files that should be considered for the commit, such as LICENSE or README. ```yaml assets: | ./LICENSE ./README ``` -------------------------------- ### Essential Inputs for AUR Deployment Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/README.md These are the mandatory inputs required to configure the action for deploying to the AUR. Ensure these are correctly set, especially secrets for authentication. ```yaml pkgname: 'my-package' # Required pkgbuild: './PKGBUILD' # Required commit_username: ${{ secrets.AUR_USERNAME }} # Required commit_email: ${{ secrets.AUR_EMAIL }} # Required ssh_private_key: ${{ secrets.AUR_SSH_KEY }} # Required ``` -------------------------------- ### Specify PKGBUILD Path Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md When the PKGBUILD is generated in a specific directory, ensure the 'pkgbuild' input correctly points to its location. This prevents 'PKGBUILD not found' errors. ```yaml pkgbuild: ./build/PKGBUILD ``` -------------------------------- ### Stage All Repository Files Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Stages all files within the local repository for git commit. This is performed when the 'assets' input is provided, ensuring all specified files are included. ```bash git add --all ``` -------------------------------- ### Minimal AUR Publishing Workflow Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md The simplest workflow to publish an AUR package. Requires repository secrets for AUR credentials and a PKGBUILD file in the repository root. ```yaml name: Publish to AUR on: push: tags: - 'v*' jobs: publish-aur: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Publish AUR package uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: my-awesome-package pkgbuild: ./PKGBUILD commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} ``` -------------------------------- ### Run updpkgsums to update package checksums Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Use this input when you need to update package checksums in the PKGBUILD file. It only runs if the value is exactly 'true'. ```yaml updpkgsums: 'true' # Update checksums updpkgsums: 'false' # Skip (default) ``` -------------------------------- ### AUR Package Name Input Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Specifies the 'pkgname' input, which is the AUR package name used to construct the git repository URL. It is a required non-empty string. ```yaml pkgname: my-awesome-package ``` -------------------------------- ### Deploy Multiple AUR Packages from Monorepo Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md This workflow deploys multiple related packages to AUR from a monorepo structure. It uses a matrix strategy to iterate over different packages, each with its own PKGBUILD file. ```yaml name: Deploy Multiple AUR Packages on: push: tags: - 'v*' jobs: deploy-all: runs-on: ubuntu-latest strategy: matrix: package: - name: my-lib pkgbuild: ./packages/lib/PKGBUILD - name: my-lib-bin pkgbuild: ./packages/lib-bin/PKGBUILD - name: my-cli pkgbuild: ./packages/cli/PKGBUILD steps: - uses: actions/checkout@v4 - name: Build all packages run: bash ./scripts/build-all.sh - name: Publish ${{ matrix.package.name }} uses: KSXGitHub/github-actions-deploy-aur@v1 with: pkgname: ${{ matrix.package.name }} pkgbuild: ${{ matrix.package.pkgbuild }} updpkgsums: 'true' test: 'true' commit_username: ${{ secrets.AUR_USERNAME }} commit_email: ${{ secrets.AUR_EMAIL }} ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} commit_message: 'Release ${{ github.ref_name }}' ``` -------------------------------- ### Copy Additional Assets to Local Repo Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Conditionally copies additional assets specified by glob patterns into the local repository. This is executed only if the 'assets' input is non-empty. ```bash if [[ -n "$assets" ]]; then cp -rvt /tmp/local-repo/ $assets fi ``` -------------------------------- ### GitHub Actions Logging Group Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Wraps commands in GitHub Actions group format to create collapsible log sections in the UI, improving log readability. ```bash echo '::group::Step Name' # commands here echo '::endgroup::' ``` -------------------------------- ### Input: assets Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Newline-separated glob patterns for additional files to copy into the AUR repository. This input is optional. ```APIDOC ## Input: assets ### Description Newline-separated glob patterns for additional files to copy into the AUR repository. Patterns are expanded by bash. ### Type string ### Required No ### Default Empty string ### Environment Variable `INPUT_ASSETS` ### Example ```yaml assets: | ./LICENSE ./README.md ./src/* assets: '' # No additional assets ``` ``` -------------------------------- ### force_push Input Configuration Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Configures whether to use `git push --force` when pushing to the AUR. This is a boolean input that defaults to 'false'. ```APIDOC ## Input: force_push ### Description Whether to use `git push --force` when pushing to the AUR. This input controls the behavior of the Git push operation, allowing for force pushes to overwrite remote history when set to 'true'. ### Type string (boolean) ### Required No ### Default `'false'` ### Environment Variable `INPUT_FORCE_PUSH` ### Valid Values `'true'` or `'false'` ### Behavior (when `'false'`): ```bash git push -v aur master ``` - Normal push - Fails if remote history has diverged ### Behavior (when `'true'`): ```bash git push -v --force aur master ``` - Force push that overwrites remote history - Use only when you own the entire branch ### Warning Force pushing can overwrite other users' work. Use with caution. ### Error Handling - Invalid values cause exit code 3 ### Example ```yaml force_push: 'false' # Normal push (default) force_push: 'true' # Force push (use carefully) ``` ``` -------------------------------- ### Pass flags to makepkg during test build Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Specify space-separated command-line flags to be passed to makepkg when the 'test' input is enabled. This allows for customization of the test build process. ```yaml test_flags: '--clean --cleanbuild --nodeps' test_flags: '--clean --cleanbuild --nodeps --nosign' test_flags: '--nodeps' # Minimal flags ``` -------------------------------- ### Parse Build Inputs Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Parses various inputs provided as GitHub Actions environment variables into bash variables. These inputs control package name, build options, commit details, and SSH key management. ```bash pkgname=$INPUT_PKGNAME pkgbuild=$INPUT_PKGBUILD assets=$INPUT_ASSETS updpkgsums=$INPUT_UPDPKGSUMS test=$INPUT_TEST read -r -a test_flags <<< "$INPUT_TEST_FLAGS" post_process=$INPUT_POST_PROCESS commit_username=$INPUT_COMMIT_USERNAME commit_email=$INPUT_COMMIT_EMAIL ssh_private_key=$INPUT_SSH_PRIVATE_KEY commit_message=$INPUT_COMMIT_MESSAGE allow_empty_commits=$INPUT_ALLOW_EMPTY_COMMITS force_push=$INPUT_FORCE_PUSH ssh_keyscan_types=$INPUT_SSH_KEYSCAN_TYPES ``` -------------------------------- ### Execute custom shell commands after SRCINFO generation Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Provide shell commands to be executed in the cloned AUR repository after .SRCINFO generation and before committing. Be cautious as commands are executed via 'eval'. ```yaml post_process: 'echo "Build complete" && ls -la' post_process: 'rm -rf *.orig && find . -name "*.bak" -delete' post_process: | if [ -f ./build-log.txt ]; then cat ./build-log.txt >> .SRCINFO fi ``` -------------------------------- ### Publish on Version Tags Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md Configure your GitHub Actions workflow to trigger on push events for version tags (e.g., v1.0.0). This is useful for releasing new package versions. ```yaml on: push: tags: - 'v*' ``` -------------------------------- ### Action Metadata Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/api-reference.md Defines the core metadata for the 'Publish AUR package' GitHub Action, including its name, description, author, and execution method. ```yaml name: 'Publish AUR package' description: 'Publish an AUR package' author: KSXGitHub branding: color: blue icon: package runs: using: 'docker' image: 'Dockerfile' ``` -------------------------------- ### Manual Publish Trigger Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md Set up a GitHub Actions workflow that can be triggered manually from the GitHub UI. This allows for on-demand package publishing with input parameters. ```yaml on: workflow_dispatch: inputs: package_name: description: 'Package to publish' required: true ``` -------------------------------- ### Test SSH Key Access to AUR Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md To diagnose 'Permission denied (publickey)' errors, test your SSH key's access to the AUR directly using the provided command. Ensure the key is correctly configured in GitHub secrets. ```bash ssh -i ~/.ssh/aur -T aur@aur.archlinux.org ``` -------------------------------- ### Clone AUR Package Repository Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Clones the specified AUR package repository from aur.archlinux.org using HTTPS into the '/tmp/local-repo' directory. Verbose output is enabled to show the cloning process. ```bash git clone -v "https://aur.archlinux.org/${pkgname}.git" /tmp/local-repo ``` -------------------------------- ### Publish on Multiple Branches and Tags Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/integration-examples.md Configure a GitHub Actions workflow to trigger on push events to specified branches (main, develop) and any tag. This provides flexibility for continuous integration and release management. ```yaml on: push: branches: - main - develop tags: - '*' ``` -------------------------------- ### Force Push with Caution Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/errors-and-exit-codes.md Use 'force_push: "true"' only if you are certain you own the entire branch and understand the implications of overwriting history. This is typically used to resolve 'force_push rejected' errors. ```yaml force_push: 'true' ``` -------------------------------- ### Generating .SRCINFO Metadata Source: https://github.com/ksxgithub/github-actions-deploy-aur/blob/master/_autodocs/execution-flow.md Generates the .SRCINFO metadata file required by the AUR. This file contains package metadata and build dependencies. It is created by piping the output of makepkg --printsrcinfo. ```bash cd /tmp/local-repo makepkg --printsrcinfo >.SRCINFO ```