Migrate from deprecate release actions to softprops/action-gh-release #85
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 6.0.x | |
- name: Install dependencies | |
run: dotnet restore | |
- name: Check for vulnerable packages | |
run: | | |
set -e # This will cause the script to exit on the first error | |
OUTPUT=$(dotnet list package --vulnerable) | |
echo "$OUTPUT" | |
if echo "$OUTPUT" | grep -q 'no vulnerable packages'; then | |
echo "No vulnerable packages found" | |
else | |
if echo "$OUTPUT" | grep -q 'vulnerable'; then | |
echo "Vulnerable packages found" | |
exit 1 | |
fi | |
fi | |
- name: Build win-x64 | |
run: dotnet publish src/Elmah.Io.Cli/Elmah.Io.Cli.csproj -c Release --runtime win-x64 --self-contained -o elmahio-win-x64 /p:AssemblyVersion=5.1.${{ github.run_number }} | |
- name: Build linux-x64 | |
run: dotnet publish src/Elmah.Io.Cli/Elmah.Io.Cli.csproj -c Release --runtime linux-x64 --self-contained -o elmahio-linux-x64 /p:AssemblyVersion=5.1.${{ github.run_number }} | |
- name: Build osx-x64 | |
run: dotnet publish src/Elmah.Io.Cli/Elmah.Io.Cli.csproj -c Release --runtime osx-x64 --self-contained -o elmahio-osx-x64 /p:AssemblyVersion=5.1.${{ github.run_number }} | |
- name: Pack .NET Core tool | |
run: dotnet pack -c Release src/Elmah.Io.Cli/Elmah.Io.Cli.csproj /p:Version=5.1.${{ github.run_number }} | |
- name: Pack executables | |
shell: bash | |
run: | | |
7z a -tzip "./artifacts/elmahio-win-x64.zip" "./elmahio-win-x64/*" | |
tar czvf "./artifacts/elmahio-linux-x64.tar.gz" "elmahio-linux-x64" | |
tar czvf "./artifacts/elmahio-osx-x64.tar.gz" "elmahio-osx-x64" | |
rm -r "elmahio-win-x64" | |
rm -r "elmahio-linux-x64" | |
rm -r "elmahio-osx-x64" | |
- name: Create Release | |
if: ${{ github.event_name == 'push' }} | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
./artifacts/elmahio-win-x64.zip | |
./artifacts/elmahio-linux-x64.tar.gz | |
./artifacts/elmahio-osx-x64.tar.gz | |
tag_name: 5.1.${{ github.run_number }} | |
name: 5.1.${{ github.run_number }} | |
draft: false | |
fail_on_unmatched_files: true | |
generate_release_notes: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push to nuget.org | |
run: dotnet nuget push src/Elmah.Io.Cli/nupkg/Elmah.Io.Cli.5.1.${{ github.run_number }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
if: ${{ github.event_name == 'push' }} |