Skip to content
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

Allow setting a custom install dir #41

Merged
merged 1 commit into from Dec 23, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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