Skip to content

[repo] Prepare release coreunstable-1.9.0-alpha.2 (#5662) #1294

[repo] Prepare release coreunstable-1.9.0-alpha.2 (#5662)

[repo] Prepare release coreunstable-1.9.0-alpha.2 (#5662) #1294

#################################################
################### IMPORTANT ###################
# DON'T RENAME THIS FILE UNLESS WE START
# RELEASING THE VERSION 2.*
################### IMPORTANT ###################
#################################################
name: Build, pack, and publish to MyGet
on:
workflow_dispatch:
push:
tags:
- 'core-*'
- 'coreunstable-*'
schedule:
- cron: '0 0 * * *' # once in a day at 00:00
jobs:
automation:
uses: ./.github/workflows/automation.yml
secrets: inherit
build-pack-publish:
runs-on: windows-latest
outputs:
artifact-url: ${{ steps.upload-artifacts.outputs.artifact-url }}
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
- name: Setup dotnet
uses: actions/setup-dotnet@v4
- name: dotnet restore
run: dotnet restore ./build/OpenTelemetry.proj -p:RunningDotNetPack=true
- name: dotnet build
run: dotnet build ./build/OpenTelemetry.proj --configuration Release --no-restore -p:Deterministic=true -p:BuildNumber=${{ github.run_number }} -p:RunningDotNetPack=true
- name: dotnet pack
run: dotnet pack ./build/OpenTelemetry.proj --configuration Release --no-restore --no-build -p:PackTag=${{ github.ref_type == 'tag' && github.ref_name || '' }}
- name: Publish Artifacts
id: upload-artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.ref_name }}-packages
path: '**/bin/**/*.*nupkg'
- name: Publish MyGet
env:
MYGET_TOKEN_EXISTS: ${{ secrets.MYGET_TOKEN != '' }}
if: env.MYGET_TOKEN_EXISTS == 'true' # Skip MyGet publish if run on a fork without the secret
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
post-build:
runs-on: ubuntu-latest
needs:
- automation
- build-pack-publish
if: needs.automation.outputs.enabled && github.event_name == 'push'
env:
GH_TOKEN: ${{ secrets[needs.automation.outputs.token-secret-name] }}
steps:
- name: check out code
uses: actions/checkout@v4
with:
token: ${{ secrets[needs.automation.outputs.token-secret-name] }}
- name: Create GitHub Release draft
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
CreateDraftRelease `
-gitRepository '${{ github.repository }}' `
-tag '${{ github.ref_name }}'
- name: Post notice when packages are ready
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
TryPostPackagesReadyNoticeOnPrepareReleasePullRequest `
-gitRepository '${{ github.repository }}' `
-tag '${{ github.ref_name }}' `
-tagSha '${{ github.sha }}' `
-packagesUrl '${{ needs.build-pack-publish.outputs.artifact-url }}' `
-botUserName '${{ needs.automation.outputs.username }}'