Skip to content

Commit f5ada59

Browse files
authored
Merge pull request #52 from dcelasun/feat/add-pgp-support
Add support for loading PGP keys
2 parents 5b75404 + c53aa59 commit f5ada59

File tree

5 files changed

+47
-24
lines changed

5 files changed

+47
-24
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,23 @@ jobs:
2626
2727
- name: Get sample package
2828
run: |
29-
mkdir visual-studio-code-bin
30-
pushd visual-studio-code-bin
31-
wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/PKGBUILD
32-
wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/.SRCINFO
33-
wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/visual-studio-code-bin.install
34-
wget https://github.com/dcelasun/pkgbuilds/raw/ee68e4c19c40a0a36a50e289259fcfd94f43786d/visual-studio-code-bin/visual-studio-code-bin.sh
29+
# Spotify 1:1.2.63.394-1
30+
mkdir spotify
31+
pushd spotify
32+
wget https://github.com/christian-heusel/aur/raw/5032e51a0b493cb7149264ec27a761ac85c81933/spotify/PKGBUILD
33+
wget https://github.com/christian-heusel/aur/raw/5032e51a0b493cb7149264ec27a761ac85c81933/spotify/.SRCINFO
34+
wget https://github.com/christian-heusel/aur/raw/5032e51a0b493cb7149264ec27a761ac85c81933/spotify/LICENSE
35+
wget https://github.com/christian-heusel/aur/raw/5032e51a0b493cb7149264ec27a761ac85c81933/spotify/spotify.protocol
36+
wget https://github.com/christian-heusel/aur/raw/5032e51a0b493cb7149264ec27a761ac85c81933/spotify/spotify.sh
3537
popd
3638
- name: Running test
3739
uses: ./
3840
with:
39-
pkgver: '1.100.1'
40-
pkgrel: 1
41+
pkgrel: 2
4142
updpkgsums: true
4243
srcinfo: true
43-
path: 'visual-studio-code-bin'
44+
path: 'spotify'
45+
pgpkeys: 'C85668DF69375001'
4446

4547
- name: Show diff
4648
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@ Here's what this action can do:
2121

2222
Following inputs can be used as `step.with` keys
2323

24-
| Name | Type | Default | Required | Description |
25-
| -------------------------- | ------- | ------------------ | -------- | -------------------------------------------------------------------------------- |
26-
| `path` | String | | `false` | Path where PKGBUILD is located. This path always located under $GITHUB_WORKSPACE |
27-
| `pkgver` | String | | `false` | Update `pkgver` on your PKGBUILD |
28-
| `pkgrel` | Integer | | `false` | Update `pkgrel` on your PKGBUILD |
29-
| `updpkgsums` | Boolean | `false` | `false` | Update checksums on your PKGBUILD |
30-
| `srcinfo` | Boolean | `false` | `false` | Generate new .SRCINFO |
31-
| `namcap` | Boolean | `true` | `false` | Validate PKGBUILD |
32-
| `flags` | String | `-cfs --noconfirm` | `false` | Flags after `makepkg` command. Leave this empty will disable this command. |
33-
| `aur` | Boolean | `false` | `false` | Resolve dependencies using paru |
34-
| `update_archlinux_keyring` | Boolean | `true` | `false` | Update the archlinux keyring |
24+
| Name | Type | Default | Required | Description |
25+
|----------------------------|---------|-------------------------------|----------|----------------------------------------------------------------------------------|
26+
| `path` | String | | `false` | Path where PKGBUILD is located. This path always located under $GITHUB_WORKSPACE |
27+
| `pkgver` | String | | `false` | Update `pkgver` on your PKGBUILD |
28+
| `pkgrel` | Integer | | `false` | Update `pkgrel` on your PKGBUILD |
29+
| `updpkgsums` | Boolean | `false` | `false` | Update checksums on your PKGBUILD |
30+
| `srcinfo` | Boolean | `false` | `false` | Generate new .SRCINFO |
31+
| `namcap` | Boolean | `true` | `false` | Validate PKGBUILD |
32+
| `flags` | String | `-cfs --noconfirm` | `false` | Flags after `makepkg` command. Leave this empty will disable this command. |
33+
| `aur` | Boolean | `false` | `false` | Resolve dependencies using paru |
34+
| `update_archlinux_keyring` | Boolean | `true` | `false` | Update the archlinux keyring |
35+
| `pgpkeys` | String | | `false` | Comma-separated PGP public keys to be loaded before calling makepkg. |
36+
| `pgpkeyserver` | String | `hkps://keyserver.ubuntu.com` | `false` | PGP key server address. |
3537

3638
### Examples
3739

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ inputs:
4343
description: 'Update archlinux-keyring'
4444
default: 'true'
4545
required: false
46+
pgpkeys:
47+
description: 'Comma-separated pgp keys'
48+
default: ''
49+
required: false
50+
pgpkeyserver:
51+
description: 'PGP key server'
52+
default: 'hkps://keyserver.ubuntu.com'
53+
required: false
4654

4755
runs:
4856
using: 'docker'
@@ -57,3 +65,5 @@ runs:
5765
- ${{ inputs.namcap }}
5866
- ${{ inputs.aur }}
5967
- ${{ inputs.archlinux_keyring }}
68+
- ${{ inputs.pgpkeys }}
69+
- ${{ inputs.pgpkeyserver }}

entrypoint.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ cd $HOME
99
mkdir gh-action
1010
cd gh-action
1111

12+
if [[ -n $INPUT_PGPKEYS ]]; then
13+
echo "::group::Loading PGP keys"
14+
for key in ${INPUT_PGPKEYS//,/$'\n'}; do
15+
gpg --keyserver $INPUT_PGPKEYSERVER --recv-keys $key
16+
done
17+
echo "::endgroup::"
18+
fi
19+
1220
# If there is a custom path, we need to copy the whole repository
1321
# because we run "git diff" at several stages and without the entire
1422
# tree the output will be incorrect.
@@ -33,31 +41,31 @@ fi
3341
if [[ -n $INPUT_PKGVER ]]; then
3442
echo "::group::Updating pkgver on PKGBUILD"
3543
sed -i "s:^pkgver=.*$:pkgver=$INPUT_PKGVER:g" PKGBUILD
36-
git diff PKGBUILD
44+
git --no-pager diff PKGBUILD
3745
echo "::endgroup::"
3846
fi
3947

4048
# Update pkgrel
4149
if [[ -n $INPUT_PKGREL ]]; then
4250
echo "::group::Updating pkgrel on PKGBUILD"
4351
sed -i "s:^pkgrel=.*$:pkgrel=$INPUT_PKGREL:g" PKGBUILD
44-
git diff PKGBUILD
52+
git --no-pager diff PKGBUILD
4553
echo "::endgroup::"
4654
fi
4755

4856
# Update checksums
4957
if [[ $INPUT_UPDPKGSUMS == true ]]; then
5058
echo "::group::Updating checksums on PKGBUILD"
5159
updpkgsums
52-
git diff PKGBUILD
60+
git --no-pager diff PKGBUILD
5361
echo "::endgroup::"
5462
fi
5563

5664
# Generate .SRCINFO
5765
if [[ $INPUT_SRCINFO == true ]]; then
5866
echo "::group::Generating new .SRCINFO based on PKGBUILD"
5967
makepkg --printsrcinfo >.SRCINFO
60-
git diff .SRCINFO
68+
git --no-pager diff .SRCINFO
6169
echo "::endgroup::"
6270
fi
6371

0 commit comments

Comments
 (0)