A GitHub Publish #236
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: A GitHub Publish | |
permissions: | |
packages: write | |
contents: write | |
on: workflow_dispatch | |
jobs: | |
github-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.100' | |
- name: Download artifact | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: pre-release-pack.yml | |
# workflow_conclusion: success | |
name: ServiceStack Packages | |
commit: ${{ github.sha }} | |
path: ./build/staging | |
- name: Check output | |
working-directory: ./build | |
run: | | |
cd staging | |
export number_of_packages=$(ls -1 | wc -l) | |
echo "number_of_packages=${number_of_packages}" >> $GITHUB_ENV | |
- name: Clear packages | |
working-directory: ./build/staging | |
shell: bash | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token | |
cp ../clear-github-packages.sh . | |
chmod +x ./clear-github-packages.sh | |
./clear-github-packages.sh | |
- name: Push to GitHub | |
working-directory: ./build/staging | |
run: | | |
# Check if more than 73 packages | |
if [[ ${number_of_packages} -gt 73 ]]; then | |
echo "Pushing to GitHub Packages" | |
dotnet nuget push '*.nupkg' --source https://nuget.pkg.github.com/ServiceStack/index.json --api-key ${{ secrets.GITHUB_TOKEN }} | |
else | |
echo 'Less files than expected, skipping push' | |
exit 1 | |
fi |