Skip to content

archlinux-downgrade/aur-publish-action

Repository files navigation

AUR Publish

Publish an update to an existing AUR package.

Script Details

The bin/aur-publish script automates the following typical process for releasing a new version of an AUR package:

  1. Clone the aur repository
  2. Update pkgver and pkgrel
  3. Update the checksums and .SRCINFO file
  4. Commit and push

This repository wraps that script in a Docker image and GitHub Action, allowing fully automating the release of a project through to publishing it to the AUR.

Important

The script has special-handling for versions with hyphens, which are not allowed in Arch Linux. It will replace any hyphens with underscores when setting the pkgver in the PKGBUILD. If you expect this to occur, your PKGBUILD must take care to restore those hyphens where it matters, such as when fetching sources.

See the wiki.

Script Usage

You can place bin/aur-publish on $PATH and use it directly.

Note

This will skip any SSH configuration before cloning; you are expected to have that pre-configured.

% aur-publish --help
aur-publish --version=VERSION [--release=NUMBER] [--[no-]publish] PACKAGE
Update an existing PKGBUILD's pkgver and publish

Options:
  --version VERSION             Updated pkgver, required
  --release NUMBER              Updated pkgrel, default is 1

  --git-email EMAIL             If given, set this git email before comitting
  --git-username NAME           If given, set this git username before comitting

  --dry-run                     Print what we'd do and exit without doing so

  --[no-]publish                Actually push to the AUR repository or not,
                                default is NOT to publish

  --sed SCRIPT                  Run `sed -i SCRIPT PKGBUILD'

                                Can be given multiple times. This occurs after
                                updating version and release but before running
                                updpkgsums and can be useful to apply one-time
                                updates, such as changing the project URL.

  -h, --help                    Show this usage

  PACKAGE                       Name of AUR package to publish

Environment:
  SSH_PRIVATE_KEY               Private key with AUR access, if run in Docker

Docker Example

% docker build --tag aur-publish .
% docker run -it --rm \
  --env "SSH_PRIVATE_KEY=$(< ~/.ssh/aur)" \
  aur-publish \
  aur-publish downgrade \
    --version "11.5.1-rc-aur.1" \
    --git-email "$(git config get user.email)" \
    --git-username "$(git config get user.name)" \
    --no-publish

GitHub Actions Example

# .github/workflows/release.yml
jobs:
  release:
    # ...
    outputs:
      published: # true if a release occurred
      version: # the version that was released

  pkgbuild:
    needs: [release]
    if: ${{ needs.release.outputs.published == 'true' }}

    runs-on: ubuntu-latest

    steps:
      - uses: archlinux-downgrade/aur-publish-action@v1
        with:
          package: downgrade
          version: ${{ needs.release.outputs.version }}
          publish: ${{ github.ref_name == 'main' }}
        env:
          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}

See downgrade for a complete example.

Inputs

name description required default
package

Name of the AUR package to publish

true ""
version

Updated pkgver to set in the PKGBUILD

true ""
release

Updated pkgrel to set in the PKGBUILD

false 1
git-email

git user.email to set before comitting

false ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
git-username

git user.name to set before committing

false ${{ github.actor }}
publish

Actually publish?

false true
sed

Additional sed expression to run on the PKGBUILD before committing

false ""

The action is licensed AGPLv3. See COPYING.

About

Publish an update to an existing AUR package

Resources

License

Stars

Watchers

Forks

Contributors