From 90871e01cbef2303dddccd990c12ef280ae6457e Mon Sep 17 00:00:00 2001 From: Mikel Blanchard Date: Thu, 6 Jun 2024 15:02:20 -0700 Subject: [PATCH] [repo] Add packages to releases when created by automation (#5674) --- .github/workflows/publish-packages-1.0.yml | 14 +++++++++++++- build/scripts/post-release.psm1 | 7 ++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-packages-1.0.yml b/.github/workflows/publish-packages-1.0.yml index 7f78116bab4..553b8bbfc62 100644 --- a/.github/workflows/publish-packages-1.0.yml +++ b/.github/workflows/publish-packages-1.0.yml @@ -26,6 +26,7 @@ jobs: outputs: artifact-url: ${{ steps.upload-artifacts.outputs.artifact-url }} + artifact-id: ${{ steps.upload-artifacts.outputs.artifact-id }} steps: - uses: actions/checkout@v4 @@ -80,6 +81,16 @@ jobs: with: token: ${{ secrets[needs.automation.outputs.token-secret-name] }} + - name: Download Artifacts + run: | + curl \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${{ github.token }}" \ + -L \ + -o '${{ github.workspace }}/artifacts/${{ github.ref_name }}-packages.zip' \ + --create-dirs \ + "https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${{ needs.build-pack-publish.outputs.artifact-id }}/zip" + - name: Create GitHub Release draft shell: pwsh run: | @@ -87,7 +98,8 @@ jobs: CreateDraftRelease ` -gitRepository '${{ github.repository }}' ` - -tag '${{ github.ref_name }}' + -tag '${{ github.ref_name }}' ` + -releaseFiles '${{ github.workspace }}/artifacts/${{ github.ref_name }}-packages.zip#Packages' - name: Post notice when packages are ready shell: pwsh diff --git a/build/scripts/post-release.psm1 b/build/scripts/post-release.psm1 index ca6ea1cc158..51010213cd5 100644 --- a/build/scripts/post-release.psm1 +++ b/build/scripts/post-release.psm1 @@ -1,7 +1,8 @@ function CreateDraftRelease { param( [Parameter(Mandatory=$true)][string]$gitRepository, - [Parameter(Mandatory=$true)][string]$tag + [Parameter(Mandatory=$true)][string]$tag, + [Parameter()][string]$releaseFiles ) $match = [regex]::Match($tag, '^(.*?-)(.*)$') @@ -74,7 +75,7 @@ $content if ($version -match '-alpha' -or $version -match '-beta' -or $version -match '-rc') { - gh release create $tag ` + gh release create $tag $releaseFiles ` --title $tag ` --verify-tag ` --notes $notes ` @@ -83,7 +84,7 @@ $content } else { - gh release create $tag ` + gh release create $tag $releaseFiles ` --title $tag ` --verify-tag ` --notes $notes `