name: rpmsign-file
description: "Sign a given .rpm file with a given .gpg key."
inputs:
  file:
    description: "File to sign."
    required: true
  gpgKey:
    description: "GPG key to sign with."
    required: true
  gpgPass:
    description: "Password to the GPG key."
    required: true
outputs:
  publicKey:
    description: "Public GPG key of the signed file."
    value: ${{ steps.sign.outputs.publicKey }}
runs:
  using: "composite"
  steps:
  - run: cp -f ${{ github.action_path }}/sign_file.sh _sign_file.sh
    shell: bash
  - name: "Sign file."
    id: sign
    uses: act/common/distros/rockylinux@master
    with:
      #Having single quotes around "${{ inputs.gpgKey }}" makes it work in act.
      args: bash "_sign_file.sh" "${{ inputs.file }}" "${{ inputs.gpgKey }}" "${{ inputs.gpgPass }}"
  - run: rm _sign_file.sh
    shell: bash
  - name: "Own artifacts."
    uses: act/common/utils/chown@master
    with:
      file: ${{ inputs.file }}
  