Skip to content

Commit a4e8a0a

Browse files
authored
Merge pull request #1 from blink1073/sign-multiple-files
Allow signing multiple files
2 parents a99bc55 + 8bca442 commit a4e8a0a

File tree

2 files changed

+31
-12
lines changed

2 files changed

+31
-12
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Use this action to create signed git artifacts:
3131
garasign_password: ${{ secrets.GRS_CONFIG_USER1_PASSWORD }}
3232
artifactory_username: ${{ secrets.ARTIFACTORY_USER }}
3333
artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
34+
skip_setup: true
3435
```
3536

3637
If the action is used multiple times within the same job, the `skip_setup`
@@ -39,11 +40,12 @@ option can be set to a truthy value to avoid unnecessary logins to artifactory.
3940
### gpg-sign
4041

4142
This action is used to create detached signatures for files:
43+
4244
```markdown
4345
- name: "Create detached signature"
4446
uses: mongodb/drivers-github-tools/garasign/gpg-sign@main
4547
with:
46-
filename: somefile.ext
48+
filenames: somefile.ext
4749
garasign_username: ${{ secrets.GRS_CONFIG_USER1_USERNAME }}
4850
garasign_password: ${{ secrets.GRS_CONFIG_USER1_PASSWORD }}
4951
artifactory_username: ${{ secrets.ARTIFACTORY_USER }}
@@ -55,6 +57,19 @@ directory.
5557
If the action is used multiple times within the same job, the `skip_setup`
5658
option can be set to a truthy value to avoid unnecessary logins to artifactory.
5759

60+
You can also supply multiple space-separated filenames to sign a list of files:
61+
62+
```markdown
63+
- name: "Create detached signature"
64+
uses: mongodb/drivers-github-tools/garasign/gpg-sign@main
65+
with:
66+
filenames: somefile.ext someotherfile.txt
67+
garasign_username: ${{ secrets.GRS_CONFIG_USER1_USERNAME }}
68+
garasign_password: ${{ secrets.GRS_CONFIG_USER1_PASSWORD }}
69+
artifactory_username: ${{ secrets.ARTIFACTORY_USER }}
70+
artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
71+
```
72+
5873
### setup
5974

6075
The setup action is used by `git-sign` and `gpg-sign` to create an env file and

garasign/gpg-sign/action.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: "Sign artifact using garasign"
22
description: "Signs a release artifact"
33
inputs:
4-
filename:
5-
description: "File name to sign"
4+
filenames:
5+
description: "File names to sign, space separated"
66
required: true
77
garasign_username:
88
description: "Garasign username"
@@ -39,13 +39,17 @@ runs:
3939
artifactory_password: ${{ inputs.artifactory_password }}
4040
artifactory_registry: ${{ inputs.artifactory_registry }}
4141

42-
- name: "Create detached signature"
42+
- name: "Create detached signature for filename"
4343
run: |
44-
podman run \
45-
--env-file=envfile \
46-
--rm \
47-
-v $(pwd):$(pwd) \
48-
-w $(pwd) \
49-
${{ inputs.artifactory_registry }}/${{ inputs.artifactory_image }} \
50-
/bin/bash -c "gpgloader && gpg --detach-sign --armor --output ${{ inputs.filename }}.sig ${{ inputs.filename }}"
51-
shell: bash
44+
export filenames="${{ inputs.filenames }}"
45+
for filename in "${filenames[@]}"
46+
do
47+
podman run \
48+
--env-file=envfile \
49+
--rm \
50+
-v $(pwd):$(pwd) \
51+
-w $(pwd) \
52+
${{ inputs.artifactory_registry }}/${{ inputs.artifactory_image }} \
53+
/bin/bash -c "gpgloader && gpg --detach-sign --armor --output ${{ inputs.filename }}.sig ${{ inputs.filename }}"
54+
done
55+
shell: bash

0 commit comments

Comments
 (0)