Skip to content

Commit

Permalink
[repo] Add packages to releases when created by automation (#5674)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeBlanch authored Jun 6, 2024
1 parent 2710c42 commit 90871e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/publish-packages-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -80,14 +81,25 @@ 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: |
Import-Module .\build\scripts\post-release.psm1
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
Expand Down
7 changes: 4 additions & 3 deletions build/scripts/post-release.psm1
Original file line number Diff line number Diff line change
@@ -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, '^(.*?-)(.*)$')
Expand Down Expand Up @@ -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 `
Expand All @@ -83,7 +84,7 @@ $content
}
else
{
gh release create $tag `
gh release create $tag $releaseFiles `
--title $tag `
--verify-tag `
--notes $notes `
Expand Down

0 comments on commit 90871e0

Please sign in to comment.