Skip to content

Commit

Permalink
Allow setting a custom install dir (#41)
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <igarcia@suse.com>
  • Loading branch information
Itxaka committed Dec 23, 2021
1 parent 116dc68 commit af5d18d
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/test-action.yml
Expand Up @@ -179,3 +179,41 @@ jobs:
with:
cosign-release: 'honk'
continue-on-error: true
test_cosign_action_custom_dir:
runs-on: ubuntu-latest
permissions:
actions: none
checks: none
contents: none
deployments: none
issues: none
packages: none
pull-requests: none
repository-projects: none
security-events: none
statuses: none
name: Install Custom Cosign and test presence in path
steps:
- uses: actions/checkout@v2
- name: Install Cosign
uses: ./
with:
install-dir: "$HOME/.cosigntest"
- name: Check install!
run: cosign version
- name: Check install dir!
run: |
if [[ $(dirname `which cosign`) == "$HOME/.cosigntest" ]]; then
exit 0
else
exit 1
fi
- name: Check root directory
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'should be clean'
exit 1
else
exit 0
fi
10 changes: 7 additions & 3 deletions action.yml
Expand Up @@ -10,15 +10,19 @@ inputs:
description: 'Cosign release version to use in the actions.'
required: false
default: 'v1.4.1'
install-dir:
description: 'Where to install the cosign binary'
required: false
default: '$HOME/.cosign'
runs:
using: "composite"
steps:
# We verify the version against a SHA **in the published action itself**, not in the GCS bucket.
- run: |
trap "popd" EXIT
mkdir -p $HOME/.cosign
pushd $HOME/.cosign
mkdir -p ${{ inputs.install-dir }}
pushd ${{ inputs.install-dir }}
bootstrap_version='v1.4.1'
expected_bootstrap_version_digest='08ba779a4e6ff827079abed1a6d1f0a0d9e48aea21f520ddeb42ff912f59d268'
Expand Down Expand Up @@ -80,5 +84,5 @@ runs:
chmod +x cosign
fi
shell: bash
- run: echo "$HOME/.cosign" >> $GITHUB_PATH
- run: echo "${{ inputs.install-dir }}" >> $GITHUB_PATH
shell: bash

0 comments on commit af5d18d

Please sign in to comment.