Skip to content

Fix actions #3

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,3 @@ You can also supply multiple space-separated filenames to sign a list of files:
artifactory_username: ${{ secrets.ARTIFACTORY_USER }}
artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
```

### setup

The setup action is used by `git-sign` and `gpg-sign` to create an env file and
sign in to artifactory. It can also be used standalone.
25 changes: 16 additions & 9 deletions garasign/git-sign/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Sign artifact using garasign"
description: "Signs a release artifact"
name: "Run git actions in a signing container"
description: "Allows running arbitrary git actions in a container with GPG keys loaded"
inputs:
command:
description: "Command to run inside the container"
Expand Down Expand Up @@ -29,15 +29,22 @@ inputs:
runs:
using: composite
steps:
- name: Prepare garasign container
- name: Create the envfile
if: ${{ inputs.skip_setup == 'false' }}
uses: ./.github/actions/garasign/setup
run: |
cat << EOF > envfile
GRS_CONFIG_USER1_USERNAME=${{ inputs.garasign_username }}
GRS_CONFIG_USER1_PASSWORD=${{ inputs.garasign_password }}
EOF
shell: bash

- name: Log in to artifactory
if: ${{ inputs.skip_setup == 'false' }}
uses: redhat-actions/podman-login@v1
with:
garasign_username: ${{ inputs.garasign_username }}
garasign_password: ${{ inputs.garasign_password }}
artifactory_username: ${{ inputs.artifactory_username }}
artifactory_password: ${{ inputs.artifactory_password }}
artifactory_registry: ${{ inputs.artifactory_registry }}
username: ${{ inputs.artifactory_username }}
password: ${{ inputs.artifactory_password }}
registry: ${{ inputs.artifactory_registry }}

- name: "Run git command"
run: |
Expand Down
43 changes: 23 additions & 20 deletions garasign/gpg-sign/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,30 @@ inputs:
runs:
using: composite
steps:
- name: Prepare garasign container
- name: Create the envfile
if: ${{ inputs.skip_setup == 'false' }}
uses: ./.github/actions/garasign/setup
run: |
cat << EOF > envfile
GRS_CONFIG_USER1_USERNAME=${{ inputs.garasign_username }}
GRS_CONFIG_USER1_PASSWORD=${{ inputs.garasign_password }}
EOF
shell: bash

- name: Log in to artifactory
if: ${{ inputs.skip_setup == 'false' }}
uses: redhat-actions/podman-login@v1
with:
garasign_username: ${{ inputs.garasign_username }}
garasign_password: ${{ inputs.garasign_password }}
artifactory_username: ${{ inputs.artifactory_username }}
artifactory_password: ${{ inputs.artifactory_password }}
artifactory_registry: ${{ inputs.artifactory_registry }}
username: ${{ inputs.artifactory_username }}
password: ${{ inputs.artifactory_password }}
registry: ${{ inputs.artifactory_registry }}

- name: "Create detached signature for filename"
- name: "Create detached signature for file"
run: |
export filenames="${{ inputs.filenames }}"
for filename in "${filenames[@]}"
do
podman run \
--env-file=envfile \
--rm \
-v $(pwd):$(pwd) \
-w $(pwd) \
${{ inputs.artifactory_registry }}/${{ inputs.artifactory_image }} \
/bin/bash -c "gpgloader && gpg --detach-sign --armor --output ${{ inputs.filename }}.sig ${{ inputs.filename }}"
done
shell: bash
podman run \
--env-file=envfile \
--rm \
-v $(pwd):$(pwd) \
-w $(pwd) \
${{ inputs.artifactory_registry }}/${{ inputs.artifactory_image }} \
/bin/bash -c 'gpgloader && for filename in "${{ inputs.filenames }}"; do gpg --detach-sign --armor --output ${filename}.sig ${filename}; done'
shell: bash
36 changes: 0 additions & 36 deletions garasign/setup/action.yml

This file was deleted.