From 798f0dea69191e80d44f6c8a88397c5a3bc1110b Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 10 May 2024 03:08:21 -0500 Subject: [PATCH] Clean up gpg-sign and papertrail actions (#5) * remove quotes * update papertrail * update papertrail * cleanup * require version * fix name --- README.md | 4 ++-- garasign/gpg-sign/action.yml | 4 ++-- papertrail/action.yml | 16 ++++++---------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 5ea467b..7bc79b9 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ You can also supply multiple space-separated filenames to sign a list of files: - name: "Create detached signature" uses: mongodb/drivers-github-tools/garasign/gpg-sign@main with: - filenames: somefile.ext someotherfile.txt + filenames: dist/* garasign_username: ${{ secrets.GRS_CONFIG_USER1_USERNAME }} garasign_password: ${{ secrets.GRS_CONFIG_USER1_PASSWORD }} artifactory_username: ${{ secrets.ARTIFACTORY_USER }} @@ -87,6 +87,6 @@ By default it will create a "papertrail.txt" file in the current directory. with: product_name: Mongo Python Driver release_version: ${{ github.ref_name }} - filenames: $DIST_FILES + filenames: dist/* token: ${{ github.token }} ``` diff --git a/garasign/gpg-sign/action.yml b/garasign/gpg-sign/action.yml index e8c4dc6..d9440e3 100644 --- a/garasign/gpg-sign/action.yml +++ b/garasign/gpg-sign/action.yml @@ -2,7 +2,7 @@ name: "Sign artifact using garasign" description: "Signs a release artifact" inputs: filenames: - description: "File names to sign, space separated" + description: "File name(s) to sign, can be a glob pattern" required: true garasign_username: description: "Garasign username" @@ -54,5 +54,5 @@ runs: -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' + /bin/bash -c 'gpgloader && for filename in ${{ inputs.filenames }}; do gpg --detach-sign --armor --output ${filename}.sig ${filename}; done' shell: bash diff --git a/papertrail/action.yml b/papertrail/action.yml index 4afdea1..9df1888 100644 --- a/papertrail/action.yml +++ b/papertrail/action.yml @@ -5,17 +5,17 @@ inputs: description: "Name of product" required: true release_version: - description: "The release version. If not provided, the github.ref_name variable will be used" - required: false + description: "The release version" + required: true filenames: - description: "Artifact filenames to include in the report, space-separated" + description: "Artifact filename(s) to include in the report, can be a glob pattern" required: true token: description: "The GitHub token for the action" required: true output: description: "The output filename" - default: "papertail.txt" + default: "papertrail.txt" runs: using: composite @@ -26,16 +26,12 @@ runs: export GH_TOKEN=${{ inputs.token }} NAME=$(gh api users/${{ github.actor }} --jq '.name') export PAPERTRAIL="${{ inputs.output }}" - export VERSION="${{ github.ref_name }}" - if [ -n "${{ inputs.release_version }}" ]; then - export VERSION="${{ inputs.release_version }}" - fi echo "Product: ${{ inputs.product_name }}" > $PAPERTRAIL - echo "Version: $VERSION" >> $PAPERTRAIL + echo "Version: ${{ inputs.release_version }}" >> $PAPERTRAIL echo "Releaser: $NAME" >> $PAPERTRAIL echo "Build Source: GitHub Actions" echo "Build Number: ${{ github.run_id }}" - for filename in"${{ inputs.filenames }}"; do + for filename in ${{ inputs.filenames }}; do SHA=$(shasum -a 256 $filename | awk '{print $1;}') echo "Filename: $filename" >> $PAPERTRAIL echo "Shasum: $SHA" >> $PAPERTRAIL