name: Publish to AUR

on:
  push:
    tags:
      - "*"
  workflow_dispatch:

jobs:
  publish:
    name: Patch, Test and Publish PKGBUILD 
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Setup docker CLI
        uses: actions-hub/docker/cli@master
        env:
          SKIP_LOGIN: true
      
      - name: Create SSH_CREDS directory
        run: mkdir ./package/aur/ssh_creds
      
      - name: Setup SSH Credentials
        run: echo ${{ secrets.SSH_CREDS }} | base64 -d | tar -xzvf - -C ./package/aur/ssh_creds
        
      - run: ls -lah ./package/aur/ssh_creds
    
      - name: AUR Routine
        run: docker build -t aur_routine package/aur && docker run aur_routine
