Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[METAED-1560] Fix vscode-metaed-ide extension publishing problems #47

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 20 additions & 53 deletions .github/workflows/on-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,39 +107,19 @@ jobs:
actions: read
contents: write
steps:
- name: Securely retrieve the package from artifacts
uses: Ed-Fi-Alliance-OSS/slsa-github-generator/.github/actions/secure-download-artifact@main
with:
- name: Securely retrieve the package from artifacts
uses: Ed-Fi-Alliance-OSS/slsa-github-generator/.github/actions/secure-download-artifact@main
with:
name: vscode-metaed.vsix
path: vscode-metaed.vsix
sha256: "${{ needs.package.outputs.hash-code }}"

- name: Attach to release
shell: pwsh
run: |
$release = "${{ github.ref_name }}"
$repo = "${{ github.repository }}"
$token = "${{ env.GITHUB_TOKEN }}"
$uploadName = "vscode-metaed.vsix"

$url = "https://api.github.com/repos/$repo/releases/tags/$release"

$gh_headers = @{
"Accept" = "application/vnd.github+json"
"Authorization" = "Bearer $token"
}

$response = Invoke-RestMethod -Uri $url -Headers $gh_headers
$releaseId = $response.id

$url = "https://uploads.github.com/repos/$repo/releases/$releaseId/assets"

$gh_headers["Content-Type"] = "application/octet"
Invoke-RestMethod -Method POST `
-Uri "$($url)?name=$($uploadName)" `
-Headers $gh_headers `
-InFile $uploadName


- name: Attach to release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 #v2.0.8
if: startsWith(github.ref, 'refs/tags/')
with:
files: vscode-metaed.vsix
CSR2017 marked this conversation as resolved.
Show resolved Hide resolved
token: ${{ env.GITHUB_TOKEN }}

sbom-attach:
name: Attach SBOM file
Expand All @@ -156,31 +136,18 @@ jobs:
path: ${{ env.MANIFEST_FILE }}
sha256: "${{ needs.package.outputs.sbom-hash-code }}"

- name: Attach to release
- name: Compress SBOM file
id: compress
shell: pwsh
run: |
$release = "${{ github.ref_name }}"
$repo = "${{ github.repository }}"
$token = "${{ secrets.GITHUB_TOKEN }}"
$file = "${{ env.MANIFEST_FILE }}"
$uploadName = "${{ env.PACKAGE_NAME }}-SBOM.zip"

$url = "https://api.github.com/repos/$repo/releases/tags/$release"

$gh_headers = @{
"Accept" = "application/vnd.github+json"
"Authorization" = "Bearer $token"
}

$response = Invoke-RestMethod -Uri $url -Headers $gh_headers
$releaseId = $response.id

$url = "https://uploads.github.com/repos/$repo/releases/$releaseId/assets"

Compress-Archive $file -DestinationPath $uploadName

$gh_headers["Content-Type"] = "application/octet"
Invoke-RestMethod -Method POST `
-Uri "$($url)?name=$($uploadName)" `
-Headers $gh_headers `
-InFile $uploadName
"uploadName=$uploadName" >> $env:GITHUB_OUTPUT

- name: Attach to release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 #v2.0.8
if: startsWith(github.ref, 'refs/tags/')
with:
files: "${{ steps.compress.outputs.uploadName }}"
token: ${{ env.GITHUB_TOKEN }}
Loading