Skip to content

Commit

Permalink
build: update workflow for all packages
Browse files Browse the repository at this point in the history
  • Loading branch information
elementh committed May 22, 2023
1 parent 57ce4f5 commit 7b47f43
Showing 1 changed file with 45 additions and 49 deletions.
94 changes: 45 additions & 49 deletions .github/workflows/thankifi.common.filters.abstractions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
types:
- published
env:
# Stop wasting time caching packages
# Stop wasting time caching packages / Disable sending usage data to Microsoft
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: Thankifi.Common.Filters.Abstractions
Expand All @@ -17,75 +17,71 @@ env:
GITHUB_USER: thankifibot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOCAL_NUGET_DIRECTORY: ${{ github.workspace}}/nuget
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
source-url: ${{ env.GITHUB_FEED }}/index.json
- name: Restore
working-directory: ./src
run: dotnet restore
- name: Build
working-directory: ./src
run: dotnet build -c Release --no-restore
- name: Test
- name: Run tests
working-directory: ./src
run: dotnet test -c Release
- name: Pack
if: matrix.os == 'ubuntu-latest'
run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$GITHUB_RUN_ID src/$PROJECT_NAME/$PROJECT_NAME.csproj
- name: Upload Artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg
prerelease:
needs: build
if: github.ref == 'refs/heads/develop'
run: dotnet test --configuration Release
build:
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v1
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
source-url: ${{ env.GITHUB_FEED }}/index.json
- name: Restore
working-directory: ./src
run: dotnet restore
- name: Pack
working-directory: ./src
run: dotnet pack --configuration Release --no-restore --include-symbols --include-source --output ${{ env.LOCAL_NUGET_DIRECTORY }} $PROJECT_NAME/$PROJECT_NAME.csproj
- uses: actions/upload-artifact@v3
with:
name: nupkg
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
if-no-files-found: error
retention-days: 7
path: ${{ env.LOCAL_NUGET_DIRECTORY }}/*.nupkg
deploy:
needs: build
needs: [ build, test ]
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
source-url: ${{ env.GITHUB_FEED }}/index.json
- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Clean Version: $VERSION
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
- name: Retrieve artifact
uses: actions/download-artifact@v3
with:
name: nupkg
path: ${{ env.LOCAL_NUGET_DIRECTORY }}
# - name: Create Release NuGet package
# run: |
# arrTag=(${GITHUB_REF//\// })
# VERSION="${arrTag[2]}"
# echo Version: $VERSION
# VERSION="${VERSION//v}"
# echo Clean Version: $VERSION
# dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME/$PROJECT_NAME.*proj
- name: Push to GitHub Feed
working-directory: ${{ env.LOCAL_NUGET_DIRECTORY }}
run: |
for f in ./nupkg/*.nupkg
for f in ./*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done

0 comments on commit 7b47f43

Please sign in to comment.