Build, pack, and publish to MyGet #1265
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
################################################# | |
################### IMPORTANT ################### | |
# DON'T RENAME THIS FILE UNLESS WE START | |
# RELEASING THE VERSION 2.* | |
################### IMPORTANT ################### | |
################################################# | |
name: Build, pack, and publish to MyGet | |
on: | |
release: | |
types: [published] | |
schedule: | |
- cron: '0 0 * * *' # once in a day at 00:00 | |
jobs: | |
build-pack-publish: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Note: By default GitHub only fetches 1 commit. MinVer needs to find | |
# the version tag which is typically NOT on the first commit so we | |
# retrieve them all. | |
fetch-depth: 0 | |
ref: ${{ github.ref || 'main' }} | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
- name: dotnet restore | |
run: dotnet restore OpenTelemetry.proj -p:RunningDotNetPack=true | |
- name: dotnet build | |
run: dotnet build OpenTelemetry.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} -p:RunningDotNetPack=true | |
- name: dotnet pack | |
run: dotnet pack OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref }} | |
- name: Publish Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.ref_name }}-packages | |
path: '**/bin/**/*.*nupkg' | |
- name: Publish MyGet | |
run: | | |
nuget setApiKey ${{ secrets.MYGET_TOKEN }} -Source https://www.myget.org/F/opentelemetry/api/v2/package | |
nuget push **/bin/**/*.nupkg -Source https://www.myget.org/F/opentelemetry/api/v2/package |