Skip to content

Commit

Permalink
Update pipeline to deploy to nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Wenger committed Mar 20, 2024
1 parent eaaacbd commit a262009
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 48 deletions.
88 changes: 42 additions & 46 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,54 @@ name: DotNet- Publish to Nuget
on:
release:
types: [published]

#workflow_dispatch:


jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set env
run: |
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "SANDBOX_USERNAME=${{ secrets.SANDBOX_USERNAME }}" >> $GITHUB_ENV
echo "SANDBOX_PASSWORD=${{ secrets.SANDBOX_PASSWORD }}" >> $GITHUB_ENV
- name: Print Version
run: |
echo $VERSION
echo ${{ env.VERSION }}
- name: Setup .NET 2.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.x.x
- name: Setup .NET 3.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.x.x
- name: Setup .NET 5.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.x.x
- name: Setup .NET 6.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.x.x
- name: Restore dependencies
run: dotnet restore
- name: Build Package
run: dotnet build --no-restore --configuration Release /p:Version=${VERSION}
#- name: Test cases
# run: dotnet test --no-build --verbosity normal --configuration Release /p:Version=${VERSION}
- name: Pack Package
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output ./nuget
- name: Update resources
uses: test-room-7/action-update-file@v1
with:
- uses: actions/checkout@v2
- name: Set env
run: |
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Print Version
run: |
echo $VERSION
echo ${{ env.VERSION }}
- name: Retrieve bearer token
id: get_bearer_token
run: |
response=$(curl -X POST ${{secrets.OKTA_ACCESS_TOKEN_URL}}/connect/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=${{secrets.OKTA_CLIENT_ID}}&client_secret=${{secrets.OKTA_CLIENT_SECRET}}")
token=$(echo $response | jq -r '.access_token')
echo "BEARER_TOKEN=${token}" >> $GITHUB_ENV
echo "CLIENT_ID=${{secrets.CLIENT_ID}}" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
2.x.x
2.2.x
3.1.x
5.0.x
6.0.x
7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build Package
run: dotnet build --no-restore --configuration Release /p:Version=${VERSION}
- name: Test cases
run: dotnet test --no-build --verbosity normal --configuration Release /p:Version=${VERSION}
- name: Pack Package
run: dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output ./nuget
- name: Update resources
uses: test-room-7/action-update-file@v1
with:
file-path: ./**/*.nupkg
commit-msg: Commit Nuget Package
github-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Push Package
# run: dotnet nuget push Avalara.SDK.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${GITHUB_TOKEN}
# env:
# GITHUB_TOKEN: ${{ secrets.NUGET_API_TOKEN }}
- name: Push Package
run: dotnet nuget push Avalara.SDK.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${GITHUB_TOKEN}
env:
GITHUB_TOKEN: ${{ secrets.NUGET_API_TOKEN }}
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
pull_request:
branches: [main]

#workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
Expand Down

0 comments on commit a262009

Please sign in to comment.