Skip to content

Commit

Permalink
Merge pull request #305 from adamralph/conditional-push
Browse files Browse the repository at this point in the history
only push package during build if API key is present
  • Loading branch information
adamralph authored Dec 21, 2019
2 parents 711fafb + 315ac58 commit 0909503
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ jobs:
VERSION: ${{ secrets.VERSION }}
run: ./build.sh
- if: matrix.runs-on == 'ubuntu-latest'
run: ./push.sh ${{ secrets.MYGET_ADAMRALPH_CI_API_KEY }}
env:
MYGET_ADAMRALPH_CI_API_KEY: ${{ secrets.MYGET_ADAMRALPH_CI_API_KEY }}
run: ./push.sh
13 changes: 9 additions & 4 deletions push.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail

for package in $(find -name "*.nupkg" | grep "test" -v); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://www.myget.org/F/adamralph-ci/api/v2/package --api-key $1
done
if [[ -z "${MYGET_ADAMRALPH_CI_API_KEY}" ]]
then
echo "${0##*/}: MYGET_ADAMRALPH_CI_API_KEY is empty or not set. Skipped pushing package(s)."
else
for package in $(find -name "*.nupkg" | grep "test" -v); do
echo "${0##*/}: Pushing $package..."
dotnet nuget push $package --source https://www.myget.org/F/adamralph-ci/api/v2/package --api-key ${MYGET_ADAMRALPH_CI_API_KEY}
done
fi

0 comments on commit 0909503

Please sign in to comment.