Skip to content

Commit

Permalink
Add a workflow step for notifying contrib of new releases.
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch committed May 21, 2024
1 parent 6c0327c commit 26e091d
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 16 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Complete release

on:
workflow_dispatch:
inputs:
tag:
required: true
description: 'Release tag'
type: string
release:
types: [published]
workflow_call:
inputs:
tag:
required: true
type: string

permissions:
contents: write
pull-requests: write

jobs:
complete-release:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
with:
ref: main

- name: Create GitHub Pull Request to update stable build version in props
if: |
(github.ref_type == 'tag' && startsWith(github.ref_name, 'core-') && !contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-rc'))
|| (inputs.tag && startsWith(inputs.tag, 'core-') && !contains(inputs.tag, '-alpha') && !contains(inputs.tag, '-beta') && !contains(inputs.tag, '-rc'))
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
CreateStableVersionUpdatePullRequest `
-tag '${{ inputs.tag || github.ref_name }}'
env:
GH_TOKEN: ${{ github.token }}

- name: Invoke core version update workflow in opentelemetry-dotnet-contrib repository
shell: pwsh
env:
CONTRIB_REPO_GH_TOKEN_EXISTS: ${{ secrets.CONTRIB_REPO_GH_TOKEN != '' }}
GH_TOKEN: ${{ secrets.CONTRIB_REPO_GH_TOKEN }}
if: vars.CONTRIB_REPO && CONTRIB_REPO_GH_TOKEN_EXISTS
run : |
Import-Module .\build\scripts\post-release.psm1
InvokeCoreVersionUpdateWorkflowInRemoteRepository `
-repository '${{ vars.CONTRIB_REPO }}'
-tag '${{ inputs.tag || github.ref_name }}'
14 changes: 0 additions & 14 deletions .github/workflows/publish-packages-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ on:

permissions:
contents: write
pull-requests: write

jobs:
build-pack-publish:
Expand Down Expand Up @@ -84,16 +83,3 @@ jobs:
-tag '${{ inputs.tag || github.ref_name }}'
env:
GH_TOKEN: ${{ github.token }}

- name: Create GitHub draft Pull Request to update stable build version in props
if: |
(github.ref_type == 'tag' && startsWith(github.ref_name, 'core-') && !contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && !contains(github.ref_name, '-rc'))
|| (inputs.tag && startsWith(inputs.tag, 'core-') && !contains(inputs.tag, '-alpha') && !contains(inputs.tag, '-beta') && !contains(inputs.tag, '-rc'))
shell: pwsh
run: |
Import-Module .\build\scripts\post-release.psm1
CreateStableVersionUpdatePullRequest `
-tag '${{ inputs.tag || github.ref_name }}'
env:
GH_TOKEN: ${{ github.token }}
1 change: 1 addition & 0 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\dotnet-format.yml = .github\workflows\dotnet-format.yml
.github\workflows\markdownlint.yml = .github\workflows\markdownlint.yml
.github\workflows\package-validation.yml = .github\workflows\package-validation.yml
.github\workflows\post-release.yml = .github\workflows\post-release.yml
.github\workflows\prepare-release.yml = .github\workflows\prepare-release.yml
.github\workflows\publish-packages-1.0.yml = .github\workflows\publish-packages-1.0.yml
.github\workflows\sanitycheck.yml = .github\workflows\sanitycheck.yml
Expand Down
17 changes: 15 additions & 2 deletions build/scripts/post-release.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,21 @@ Merge once packages are available on NuGet and the build passes.
--body $body `
--base $targetBranch `
--head $branch `
--label infra `
--draft
--label infra
}

Export-ModuleMember -Function CreateStableVersionUpdatePullRequest

function InvokeCoreVersionUpdateWorkflowInRemoteRepository {
param(
[Parameter(Mandatory=$true)][string]$repository,
[Parameter(Mandatory=$true)][string]$tag
)

gh workflow run "core-version-update.yml" `
--repo $repository `
--ref "main" `
--field "tag=$tag"
}

Export-ModuleMember -Function InvokeCoreVersionUpdateWorkflowInRemoteRepository

0 comments on commit 26e091d

Please sign in to comment.