[repo] Add packages to releases when created by automation (#5674)

This commit is contained in:
Mikel Blanchard 2024-06-06 15:02:20 -07:00 committed by GitHub
parent 2710c427f0
commit 90871e01cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 4 deletions

View File

@ -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

View File

@ -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 `