token pat #8
This file contains hidden or 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/CD | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Build and Pack TonapiClient | |
| run: | | |
| dotnet restore src/TonapiClient/TonapiClient.csproj | |
| dotnet build src/TonapiClient/TonapiClient.csproj --no-restore --configuration Release | |
| dotnet pack src/TonapiClient/TonapiClient.csproj --no-build --configuration Release --output ./artifacts | |
| - name: Add GitHub Packages source | |
| run: | | |
| dotnet nuget remove source github || true | |
| dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --name github --username "${{ github.repository_owner }}" --password "${{ secrets.PAT_TOKEN }}" --store-password-in-clear-text | |
| - name: Publish to GitHub Packages | |
| run: dotnet nuget push ./artifacts/*.nupkg --source "github" --skip-duplicate | |
| - name: Publish to NuGet | |
| run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |