Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Store keys in /etc/apt/keyrings #3

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,17 @@ runs:

if [ -n "${{ inputs.key }}" ]; then
echo ::group::Add APT key
staging_key=/usr/share/keyrings/add-apt-repository.asc
mkdir -p "${{ runner.temp }}"
staging_key="${{ runner.temp }}/add-apt-repository.asc"

if [[ ${{ inputs.key }} == "http://"* ]] || [[ ${{ inputs.key }} == "https://"* ]]; then
sudo wget -O "$staging_key" -- ${{ inputs.key }}
wget -O "$staging_key" -- "${{ inputs.key }}"
else
sudo cp ${{ inputs.key }} "$staging_key"
cp "${{ inputs.key }}" "$staging_key"
fi

final_key=/usr/share/keyrings/add-apt-repository-$(sha256sum "$staging_key" | cut -d' ' -f1).asc
sudo mkdir -p /etc/apt/keyrings
final_key=/etc/apt/keyrings/add-apt-repository-$(sha256sum "$staging_key" | cut -d' ' -f1).asc
sudo mv "$staging_key" "$final_key"
echo ::endgroup::
fi
Expand Down