sailfork / t3code-github / .github/ workflows/ publish-aur.yml

name: Publish AUR package

# See packaging/aur/README.md.

on:
  workflow_call:
    inputs:
      release_tag:
        required: true
        type: string
      pkgrel:
        required: false
        default: "1"
        type: string
    secrets:
      AUR_SSH_PRIVATE_KEY:
        required: true
  workflow_dispatch:
    inputs:
      release_tag:
        description: "Release tag to publish"
        required: true
        type: string
      pkgrel:
        description: "Arch package release override"
        required: false
        default: "1"
        type: string

permissions:
  contents: read

concurrency:
  group: publish-aur
  cancel-in-progress: false

jobs:
  publish:
    name: Validate and publish
    if: github.repository == 'pingdotgg/t3code'
    runs-on: blacksmith-8vcpu-ubuntu-2404
    timeout-minutes: 30
    container:
      image: archlinux:base-devel

    steps:
      - name: Install Arch packaging tools
        run: pacman -Syu --noconfirm --needed git github-cli jq namcap openssh sudo

      - name: Checkout packaging sources
        uses: actions/checkout@v6

      - name: Create unprivileged build user
        run: |
          useradd --create-home builder
          install -Dm0440 /dev/stdin /etc/sudoers.d/builder <<'EOF'
          builder ALL=(root) NOPASSWD: /usr/bin/pacman
          EOF

      - name: Validate and publish package sources
        env:
          GH_TOKEN: ${{ github.token }}
          RELEASE_TAG: ${{ inputs.release_tag }}
          PKGREL: ${{ inputs.pkgrel || '1' }}
          AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
        run: packaging/aur/scripts/release.sh