v2.3.4 #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: Apache-2.0 | |
# Licensed to the Ed-Fi Alliance under one or more agreements. | |
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | |
# See the LICENSE and NOTICES files in the project root for more information. | |
name: On Release | |
on: | |
release: | |
types: | |
- released | |
permissions: read-all | |
env: | |
ARTIFACTS_API_KEY: ${{ secrets.AZURE_ARTIFACTS_PERSONAL_ACCESS_TOKEN }} | |
ARTIFACTS_FEED_URL: "https://pkgs.dev.azure.com/ed-fi-alliance/Ed-Fi-Alliance-OSS/_packaging/EdFi/nuget/v3/index.json" | |
ARTIFACTS_PACKAGES_URL: "https://pkgs.dev.azure.com/ed-fi-alliance/9f7770ac-66d9-4fbc-b81e-b5ad79002b62/_apis/packaging/feeds/338858dc-b976-4355-ab70-5e713b1f56be/nuget/packagesBatch?api-version=7.1-preview.1" | |
RELEASE_VIEW_ID: "53acfbeb-77f2-4ef6-8596-dc19e5802775" #Release | |
ARTIFACTS_USERNAME: ${{ secrets.AZURE_ARTIFACTS_USER_NAME }} | |
jobs: | |
delete-pre-releases: | |
name: Delete Unnecessary Pre-Releases | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Delete other pre-releases and their tags | |
shell: pwsh | |
run: | | |
$release = "${{ github.ref_name }}" | |
$repo = "${{ github.repository }}" | |
$token = "${{ secrets.GITHUB_TOKEN }}" | |
$page = 1 | |
$release_list = @() | |
Do { | |
$url = "https://api.github.com/repos/$repo/releases?per_page=100&page=$page" | |
$gh_headers = @{ | |
"Accept" = "application/vnd.github+json" | |
"Authorization" = "Bearer $token" | |
} | |
$release_list = Invoke-RestMethod $url -Headers $gh_headers | |
$release_list | ForEach-Object { | |
if ($_.tag_name -like "Pre-Release-*" -and $_.prerelease) { | |
"Deleting pre-release $($_.tag_name)" | Write-Output | |
Invoke-RestMethod -Method Delete -Uri $_.url -Headers $gh_headers | |
$tag = $_.tag_name | |
Invoke-RestMethod -Method Delete -Uri "https://api.github.com/repos/$repo/git/refs/tags/$tag" -Headers $gh_headers | |
} | |
} | |
$page += 1 | |
} While ($release_list.count -gt 0) | |
promote-Azure-artifact: | |
name: Promote Azure Artifact | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Promote Package | |
shell: pwsh | |
run: | | |
$arguments = @{ | |
PackagesURL = "${{ env.ARTIFACTS_PACKAGES_URL }}" | |
Username = "${{ env.ARTIFACTS_USERNAME }}" | |
ViewId = "${{ env.RELEASE_VIEW_ID }}" | |
ReleaseRef = "${{ github.ref_name }}" | |
Password = (ConvertTo-SecureString -String "${{ env.ARTIFACTS_API_KEY }}" -AsPlainText -Force) | |
} | |
Import-Module ./eng/promote-packages.psm1 | |
Invoke-Promote @arguments |