mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 19:50:24 +00:00
Compare commits
24 Commits
miketimofe
...
Permission
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
224b666145 | ||
|
|
d3c3feee4b | ||
|
|
4028baf988 | ||
|
|
d30950623a | ||
|
|
16b7940fde | ||
|
|
94d413c5d2 | ||
|
|
6d641c49d7 | ||
|
|
447803d00a | ||
|
|
b549ccbeee | ||
|
|
760646fc29 | ||
|
|
a8a2c841ba | ||
|
|
6fbb1f0f20 | ||
|
|
b964a9871b | ||
|
|
d4cf796ec9 | ||
|
|
b8e79c3d16 | ||
|
|
b43c6cc8fd | ||
|
|
5810329d19 | ||
|
|
896369fc7d | ||
|
|
d25937e581 | ||
|
|
c08a90cad6 | ||
|
|
2c15878a9d | ||
|
|
7b3aff2ad5 | ||
|
|
81e64845b7 | ||
|
|
56f47ea626 |
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -1 +1 @@
|
||||
* @actions/virtual-environments-owners
|
||||
* @actions/setup-actions-team
|
||||
|
||||
277
.github/workflows/build-tool-packages.yml
vendored
Normal file
277
.github/workflows/build-tool-packages.yml
vendored
Normal file
@@ -0,0 +1,277 @@
|
||||
# This reusable workflow is used by actions/*-versions repositories
|
||||
# It is designed to
|
||||
# - build and test new versions of a tool (Go, Node)
|
||||
# - publish a release with a new tool version
|
||||
# The GITHUB_TOKEN secret is used to trigger workflow runs and publish releases
|
||||
|
||||
name: Generate tool packages
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tool-name:
|
||||
description: "Tool name to build and upload. Supported values are: 'go' and 'node'"
|
||||
required: true
|
||||
type: string
|
||||
tool-version:
|
||||
description: "Tool version to build and upload"
|
||||
required: true
|
||||
type: string
|
||||
publish-release:
|
||||
description: "Whether to publish releases"
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: Build ${{ inputs.tool-name }} ${{ inputs.tool-version }} [${{ matrix.platform }}] [${{ matrix.architecture }}]
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
ARTIFACT_NAME: ${{ inputs.tool-name }}-${{ inputs.tool-version }}-${{ matrix.platform }}-${{ matrix.architecture }}
|
||||
excludewinarm: ${{ !(inputs.tool-name == 'node' && inputs['tool-version'] < '20.0.0' && matrix.architecture == 'arm64' && matrix.platform == 'win32') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [linux, darwin, win32]
|
||||
architecture: [x64, arm64]
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
if: env.excludewinarm == 'true'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Build ${{ inputs.tool-name }} ${{ inputs.tool-version }}
|
||||
if: env.excludewinarm == 'true'
|
||||
run: |
|
||||
./builders/build-${{ inputs.tool-name }}.ps1 -Version ${{ inputs.tool-version }} `
|
||||
-Platform ${{ matrix.platform }} `
|
||||
-Architecture ${{ matrix.architecture }}
|
||||
|
||||
- name: Publish artifact
|
||||
if: env.excludewinarm == 'true'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME }}
|
||||
path: ${{ runner.temp }}/artifact
|
||||
|
||||
test:
|
||||
name: Test ${{ inputs.tool-name }} ${{ inputs.tool-version }} [${{ matrix.platform }}] [${{ matrix.architecture }}]
|
||||
needs: build
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
ARTIFACT_NAME: ${{ inputs.tool-name }}-${{ inputs.tool-version }}-${{ matrix.platform }}-${{ matrix.architecture }}
|
||||
excludewinarm: ${{ !(inputs.tool-name == 'node' && inputs['tool-version'] < '20.0.0' && matrix.architecture == 'arm64' && matrix.platform == 'win32') }}
|
||||
RUNNER_TYPE: ${{ matrix.runner_type }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
platform: linux
|
||||
architecture: x64
|
||||
- os: macos-13
|
||||
platform: darwin
|
||||
architecture: x64
|
||||
- os: windows-latest
|
||||
platform: win32
|
||||
architecture: x64
|
||||
- os: setup-actions-ubuntu-arm64-2-core
|
||||
platform: linux
|
||||
architecture: arm64
|
||||
runner_type: self-hosted
|
||||
- os: macos-latest
|
||||
platform: darwin
|
||||
architecture: arm64
|
||||
- os: setup-actions-windows-arm64-4-core
|
||||
platform: win32
|
||||
architecture: arm64
|
||||
runner_type: self-hosted
|
||||
|
||||
steps:
|
||||
- name: Setup Environment on Windows ARM64 Runner
|
||||
if: matrix.os == 'setup-actions-windows-arm64-4-core'
|
||||
shell: powershell
|
||||
run: |
|
||||
# Install Chocolatey
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||
echo "C:\ProgramData\Chocolatey\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
|
||||
# Install PowerShell
|
||||
choco install powershell-core -y
|
||||
echo "C:\Program Files\PowerShell\7" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
|
||||
# Install Git
|
||||
choco install git -y
|
||||
echo "C:\Program Files\Git\cmd" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
|
||||
|
||||
# Install 7-Zip
|
||||
choco install 7zip -y
|
||||
echo "C:\ProgramData\chocolatey\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
- name: checkout
|
||||
if: env.excludewinarm == 'true'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Fully cleanup the toolcache directory before testing
|
||||
if: env.excludewinarm == 'true'
|
||||
run: ./helpers/clean-toolcache.ps1 -ToolName "${{ inputs.tool-name }}"
|
||||
|
||||
- name: Download artifact
|
||||
if: env.excludewinarm == 'true'
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: ${{ env.ARTIFACT_NAME }}
|
||||
path: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }}
|
||||
|
||||
- name: Extract files
|
||||
if: env.excludewinarm == 'true'
|
||||
run: |
|
||||
if ('${{ matrix.platform }}' -eq 'win32') {
|
||||
if ('${{ inputs.tool-name }}' -eq 'node') {
|
||||
$artifactName = "${{ env.ARTIFACT_NAME }}.7z"
|
||||
} elseif ('${{ inputs.tool-name }}' -eq 'go') {
|
||||
$artifactName = "${{ env.ARTIFACT_NAME }}.zip"
|
||||
} else {
|
||||
Write-Host "Unsupported tool - ${{ inputs.tool-name }}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
7z.exe x "$artifactName" -y | Out-Null
|
||||
} else {
|
||||
$artifactName = "${{ env.ARTIFACT_NAME }}.tar.gz"
|
||||
tar -xzf $artifactName
|
||||
}
|
||||
working-directory: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }}
|
||||
|
||||
- name: Apply build artifact to the local machine
|
||||
if: env.excludewinarm == 'true'
|
||||
run: |
|
||||
if ('${{ matrix.platform }}' -eq 'win32') { powershell ./setup.ps1 }
|
||||
else {
|
||||
sh ./setup.sh
|
||||
}
|
||||
working-directory: ${{ runner.temp }}/${{ env.ARTIFACT_NAME }}
|
||||
|
||||
- name: Setup Node.js ${{ inputs.tool-version }}
|
||||
if: env.excludewinarm == 'true' && inputs.tool-name == 'node'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.tool-version }}
|
||||
|
||||
- name: Setup Go ${{ inputs.tool-version }}
|
||||
if: inputs.tool-name == 'go'
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ inputs.tool-version }}
|
||||
|
||||
- name: Wait for the logs
|
||||
if: env.excludewinarm == 'true'
|
||||
run: |
|
||||
Write-Host "Fake step that does nothing"
|
||||
Write-Host "We need it because log from the previous step 'Setup ${{ inputs.tool-name }}' is not available here yet."
|
||||
Write-Host "In testing step we analyze build log of 'Setup ${{ inputs.tool-name }}' task"
|
||||
Write-Host "to determine if ${{ inputs.tool-name }} version was consumed from cache or if it was downloaded"
|
||||
for ($i = 0; $i -lt 200; $i++) { Get-Random }
|
||||
|
||||
- name: Run tests
|
||||
if: env.excludewinarm == 'true'
|
||||
env:
|
||||
VERSION: ${{ inputs.tool-version }}
|
||||
run: |
|
||||
Install-Module Pester -Force -Scope CurrentUser -SkipPublisherCheck
|
||||
Import-Module Pester
|
||||
$toolName = (Get-Culture).TextInfo.ToTitleCase("${{ inputs.tool-name }}")
|
||||
Invoke-Pester -Script ./$toolName.Tests.ps1 -EnableExit
|
||||
working-directory: ./tests
|
||||
|
||||
publish_release:
|
||||
name: Publish release
|
||||
if: inputs.publish-release
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
|
||||
- name: Generate release body
|
||||
id: generate-release-body
|
||||
run: |
|
||||
if ('${{ inputs.tool-name }}' -eq 'node') {
|
||||
$releaseBody = 'Node.js ${{ inputs.tool-version }}'
|
||||
} else {
|
||||
$releaseBody = 'Go ${{ inputs.tool-version }}'
|
||||
}
|
||||
echo "RELEASE_BODY=$releaseBody" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Publish Release
|
||||
id: create_release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
tag_name="${{ inputs.tool-version }}-${{ github.run_id }}"
|
||||
gh release create "$tag_name" \
|
||||
--repo="$GITHUB_REPOSITORY" \
|
||||
--title="${{ inputs.tool-version }}" \
|
||||
--notes="${{ steps.generate-release-body.outputs.RELEASE_BODY }}"
|
||||
|
||||
release_id=$(gh release view "$tag_name" --repo "$GITHUB_REPOSITORY" --json databaseId --jq '.databaseId')
|
||||
echo "id=$release_id" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate hash for packages
|
||||
run: |
|
||||
$childItems = Get-Childitem -Path '.'
|
||||
$childItems | Foreach-Object {
|
||||
$packageObj = Get-Childitem -Path $_.FullName | Select-Object -First 1
|
||||
Write-Host "Package: $($packageObj.Name)"
|
||||
$actualHash = (Get-FileHash -Path $packageObj.FullName -Algorithm sha256).Hash
|
||||
$hashString = "$actualHash $($packageObj.Name)"
|
||||
Write-Host "$hashString"
|
||||
Add-Content -Path ./hashes.sha256 -Value "$hashString"
|
||||
}
|
||||
|
||||
- name: Upload release assets
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
for (let artifactDir of fs.readdirSync('.')) {
|
||||
let artifactName = fs.lstatSync(artifactDir).isDirectory() ? fs.readdirSync(`${artifactDir}`)[0] : artifactDir;
|
||||
|
||||
console.log(`Upload ${artifactName} asset`);
|
||||
github.rest.repos.uploadReleaseAsset({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
release_id: ${{ steps.create_release.outputs.id }},
|
||||
name: artifactName,
|
||||
data: fs.lstatSync(artifactDir).isDirectory() ? fs.readFileSync(`./${artifactDir}/${artifactName}`) : fs.readFileSync(`./${artifactName}`).toString()
|
||||
});
|
||||
}
|
||||
|
||||
trigger_pr:
|
||||
name: Trigger "Create Pull Request" workflow
|
||||
needs: publish_release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Trigger "Create Pull Request" workflow
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
github.rest.actions.createWorkflowDispatch({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: 'create-pr.yml',
|
||||
ref: 'main'
|
||||
});
|
||||
4
.github/workflows/common_tests.yml
vendored
4
.github/workflows/common_tests.yml
vendored
@@ -7,7 +7,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Pester
|
||||
shell: pwsh
|
||||
@@ -20,4 +20,4 @@ jobs:
|
||||
run: |
|
||||
Import-Module Pester
|
||||
Import-Module Assert
|
||||
Invoke-Pester -EnableExit
|
||||
Invoke-Pester -EnableExit
|
||||
|
||||
43
.github/workflows/create-pr-to-update-manifest.yml
vendored
Normal file
43
.github/workflows/create-pr-to-update-manifest.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# This reusable workflow is used by actions/*-versions repositories
|
||||
# It is designed to create a PR with update of versions-manifest.json when a new release is published
|
||||
# The GITHUB_TOKEN secret is used to create versions-manifest.json and publish related PR
|
||||
|
||||
name: Create Pull Request
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tool-name:
|
||||
description: 'Name of the tool for which PR is created'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
jobs:
|
||||
create_pr:
|
||||
name: Create Pull Request
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Create versions-manifest.json
|
||||
run: |
|
||||
./helpers/packages-generation/manifest-generator.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" `
|
||||
-GitHubAccessToken "${{ secrets.GITHUB_TOKEN }}" `
|
||||
-OutputFile "./versions-manifest.json" `
|
||||
-ConfigurationFile "./config/${{ inputs.tool-name }}-manifest-config.json"
|
||||
|
||||
- name: Create GitHub PR
|
||||
run: |
|
||||
$formattedDate = Get-Date -Format "MM/dd/yyyy"
|
||||
./helpers/github/create-pull-request.ps1 `
|
||||
-RepositoryFullName "$env:GITHUB_REPOSITORY" `
|
||||
-AccessToken "${{ secrets.GITHUB_TOKEN }}" `
|
||||
-BranchName "update-versions-manifest-file" `
|
||||
-CommitMessage "Update versions-manifest" `
|
||||
-PullRequestTitle "[versions-manifest] Update for release from ${formattedDate}" `
|
||||
-PullRequestBody "Update versions-manifest.json for release from ${formattedDate}"
|
||||
109
.github/workflows/get-new-tool-versions.yml
vendored
Normal file
109
.github/workflows/get-new-tool-versions.yml
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# This reusable workflow is used by actions/*-versions repositories
|
||||
# It is designed to check for new versions of a tool (Python, Node, etc.)
|
||||
# The 'SLACK_CHANNEL_URL' secret must be added to the repository containing the caller workflow
|
||||
# in order to publish messages to Slack.
|
||||
# The 'Get Available Tools Versions - Publishing Approval' environment must be created in the repository containing the caller workflow
|
||||
# The 'trigger_builds' job requires manual approval
|
||||
# The GITHUB_TOKEN secret is used to cancel and trigger workflow runs
|
||||
|
||||
name: Get new tool versions
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tool-name:
|
||||
description: 'Name of the tool for which versions are searched'
|
||||
required: true
|
||||
type: string
|
||||
image-url:
|
||||
description: 'Tool image to be attached to Slack posts'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
jobs:
|
||||
find_new_versions:
|
||||
name: Find new versions
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
versions_output: ${{ steps.Get_new_versions.outputs.TOOL_VERSIONS }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- id: Get_new_versions
|
||||
name: Get new versions
|
||||
run: ./helpers/get-new-tool-versions/get-new-tool-versions.ps1 -ToolName ${{ inputs.tool-name }}
|
||||
|
||||
check_new_versions:
|
||||
name: Check new versions
|
||||
runs-on: ubuntu-latest
|
||||
needs: find_new_versions
|
||||
env:
|
||||
TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Check Versions
|
||||
if: env.TOOL_VERSIONS == ''
|
||||
run: |
|
||||
Write-Host "No new versions were found"
|
||||
Import-Module "./helpers/github/github-api.psm1"
|
||||
$gitHubApi = Get-GitHubApi -RepositoryFullName "$env:GITHUB_REPOSITORY" `
|
||||
-AccessToken "${{ secrets.GITHUB_TOKEN }}"
|
||||
$gitHubApi.CancelWorkflow("$env:GITHUB_RUN_ID")
|
||||
Start-Sleep -Seconds 60
|
||||
|
||||
- name: Send Slack notification
|
||||
run: |
|
||||
$pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
|
||||
$message = "The following versions of '${{ inputs.tool-name }}' are available to upload: ${{ env.TOOL_VERSIONS }}\nLink to the pipeline: $pipelineUrl"
|
||||
./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
|
||||
-ToolName "${{ inputs.tool-name }}" `
|
||||
-ImageUrl "${{ inputs.image-url }}" `
|
||||
-Text "$message"
|
||||
trigger_builds:
|
||||
name: Trigger builds
|
||||
runs-on: ubuntu-latest
|
||||
needs: [find_new_versions, check_new_versions]
|
||||
env:
|
||||
TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}}
|
||||
environment: Get Available Tools Versions - Publishing Approval
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Trigger "Build ${{ inputs.tool-name }} packages" workflow
|
||||
run: |
|
||||
$workflowFileName = "build-${{ inputs.tool-name }}-packages.yml".ToLower()
|
||||
./helpers/github/run-ci-builds.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" `
|
||||
-AccessToken "${{ secrets.GITHUB_TOKEN }}" `
|
||||
-WorkflowFileName "$workflowFileName" `
|
||||
-WorkflowDispatchRef "main" `
|
||||
-ToolVersions "${{ env.TOOL_VERSIONS }}" `
|
||||
-PublishReleases "true"
|
||||
|
||||
check_build:
|
||||
name: Check build for failures
|
||||
runs-on: ubuntu-latest
|
||||
needs: [find_new_versions, check_new_versions, trigger_builds]
|
||||
if: failure()
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Send Slack notification if build fails
|
||||
run: |
|
||||
$pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
|
||||
$message = "The build of the '${{ inputs.tool-name }}' detection pipeline failed :progress-error:\nLink to the pipeline: $pipelineUrl"
|
||||
./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
|
||||
-ToolName "${{ inputs.tool-name }}" `
|
||||
-Text "$message" `
|
||||
-ImageUrl "${{ inputs.image-url }}"
|
||||
14
.github/workflows/get-tools-new-versions.yml
vendored
14
.github/workflows/get-tools-new-versions.yml
vendored
@@ -42,7 +42,7 @@ jobs:
|
||||
name: 'Searching for new versions of ${{ matrix.tool.name }}'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- id: get-new-tool-versions
|
||||
name: Get new tool versions
|
||||
run: |
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
-ReleasesUrl ${{ matrix.tool.releases-url }} `
|
||||
-FilterParameter ${{ matrix.tool.filter-parameter }} `
|
||||
-FilterArch ${{ matrix.tool.filter-arch }}
|
||||
echo "::set-output name=versions-output::$versionsOutput"
|
||||
echo "versions-output=$versionsOutput" >> $env:GITHUB_OUTPUT
|
||||
- name: Check versions
|
||||
if: steps.get-new-tool-versions.outputs.versions-output == ''
|
||||
run: Write-Host "No new versions found"
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
name: Send Slack notification
|
||||
if: steps.get-new-tool-versions.outputs.versions-output != ''
|
||||
with:
|
||||
url: ${{ secrets.SLACK_CHANNEL_URL }}
|
||||
url: ${{ secrets.SLACK_CHANNEL_HOOK }}
|
||||
tool-name: '${{ matrix.tool.name }}'
|
||||
tool-version: ${{ steps.get-new-tool-versions.outputs.versions-output }}
|
||||
image-url: '${{ matrix.tool.image }}'
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
needs: [find-new-tool-versions]
|
||||
if: failure()
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- id: get-failed-jobs
|
||||
name: Get failed jobs
|
||||
run: |
|
||||
@@ -79,11 +79,11 @@ jobs:
|
||||
$failedJobs = (Invoke-RestMethod -Uri $jobs_url).jobs |
|
||||
Where-Object conclusion -eq "failure" |
|
||||
ForEach-Object {"\n\t" + $_.name.split(" ")[-1] + ": $($_.html_url)"}
|
||||
echo "::set-output name=failed-jobs::$failedJobs"
|
||||
echo "failed-jobs=$failedJobs" >> $env:GITHUB_OUTPUT
|
||||
- uses: ./.github/actions/send-slack-notification
|
||||
name: Send Slack notification about failure
|
||||
with:
|
||||
url: ${{ secrets.SLACK_CHANNEL_URL }}
|
||||
url: ${{ secrets.SLACK_CHANNEL_HOOK }}
|
||||
tool-name: 'Tool name'
|
||||
pipeline-url: '$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID'
|
||||
text: "Missing toolset tool versions checker pipeline has failed jobs:/n/t${{ steps.get-failed-jobs.outputs.failed-jobs }}"
|
||||
text: "Missing toolset tool versions checker pipeline has failed jobs:/n/t${{ steps.get-failed-jobs.outputs.failed-jobs }}"
|
||||
|
||||
51
.github/workflows/validate-manifest.yml
vendored
Normal file
51
.github/workflows/validate-manifest.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# This reusable workflow is used by actions/*-versions repositories
|
||||
# It is designed to validate the versions-manifest.json file
|
||||
# The 'SLACK_CHANNEL_URL' secret must be added to the repository containing the caller workflow
|
||||
# in order to publish messages to Slack
|
||||
|
||||
name: Validate manifest
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tool-name:
|
||||
description: 'Name of the tool for which manifest is validated'
|
||||
required: true
|
||||
type: string
|
||||
image-url:
|
||||
description: 'Tool image to be attached to Slack posts'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Validate manifest
|
||||
run: .\helpers\packages-generation\manifest-validator.ps1 -ManifestPath '.\versions-manifest.json'
|
||||
|
||||
check_build:
|
||||
name: Check validation for failures
|
||||
runs-on: ubuntu-latest
|
||||
needs: [validation]
|
||||
if: failure()
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Send Slack notification if validation fails
|
||||
run: |
|
||||
$pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
|
||||
$message = "The validation of ${{ inputs.tool-name }} manifest failed. \nLink to the pipeline: $pipelineUrl"
|
||||
.\helpers\get-new-tool-versions\send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
|
||||
-ToolName "${{ inputs.tool-name }}" `
|
||||
-Text "$message" `
|
||||
-ImageUrl "${{ inputs.image-url }}"
|
||||
12
README.md
12
README.md
@@ -1,5 +1,15 @@
|
||||
# Common tools for generation of packages in the actions/*-versions repositories
|
||||
This repository contains PowerShell modules that are used to generate packages for Actions. The packages are consumed by the images generated through [actions/virtual-environments](https://github.com/actions/virtual-environments) and some of the setup-* Actions
|
||||
This repository contains PowerShell modules that are used to generate packages for Actions. The packages are consumed by the images generated through [actions/runner-images](https://github.com/actions/runner-images) and some of the setup-* Actions
|
||||
|
||||
## Recommended permissions
|
||||
|
||||
When using the `versions-package-tools` in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality:
|
||||
|
||||
```yaml
|
||||
permissions:
|
||||
contents: read # access to read repository's content
|
||||
actions: read # access to reading actions
|
||||
```
|
||||
|
||||
## Contribution
|
||||
Contributions are welcome! See [Contributor's Guide](./CONTRIBUTING.md) for more details about contribution process and code structure
|
||||
|
||||
@@ -21,8 +21,7 @@ $VersionsToBuild = $VersionsFromDist | Where-Object { $VersionsFromManifest -not
|
||||
if ($VersionsToBuild) {
|
||||
$availableVersions = $VersionsToBuild -join ", "
|
||||
Write-Host "The following versions are available to build:`n${availableVersions}"
|
||||
Write-Host "::set-output name=TOOL_VERSIONS::${availableVersions}"
|
||||
Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}"
|
||||
"TOOL_VERSIONS=${availableVersions}" >> $env:GITHUB_OUTPUT
|
||||
} else {
|
||||
Write-Host "There aren't versions to build"
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ function Search-ToolsVersionsNotOnImage {
|
||||
$_.$FilterParameter.split(".")[0,1] -join"."
|
||||
}
|
||||
} | Select-Object -Unique
|
||||
$toolsetUrl = "https://raw.githubusercontent.com/actions/virtual-environments/main/images/win/toolsets/toolset-2022.json"
|
||||
$toolsetUrl = "https://raw.githubusercontent.com/actions/runner-images/main/images/win/toolsets/toolset-2022.json"
|
||||
$latestMinorVersion = (Invoke-RestMethod $toolsetUrl).toolcache |
|
||||
Where-Object {$_.name -eq $ToolName -and $_.arch -eq $FilterArch} |
|
||||
ForEach-Object {$_.versions.Replace("*","0")} |
|
||||
|
||||
@@ -6,7 +6,7 @@ function Search-XamarinVersionsNotOnImage {
|
||||
|
||||
$xamarinReleases = (Invoke-RestMethod $ReleasesUrl).items
|
||||
$filteredReleases = $xamarinReleases | Where-Object {$_.name -in $FilterProducts.name} | Sort-Object name | Select-Object name, version
|
||||
$toolsetUrl = "https://raw.githubusercontent.com/actions/virtual-environments/main/images/macos/toolsets/toolset-12.json"
|
||||
$toolsetUrl = "https://raw.githubusercontent.com/actions/runner-images/main/images/macos/toolsets/toolset-12.json"
|
||||
$uploadedReleases = (Invoke-RestMethod $toolsetUrl).xamarin
|
||||
$releasesOnImage = @()
|
||||
foreach ($FilterProduct in $FilterProducts) {
|
||||
|
||||
@@ -22,7 +22,7 @@ if ($ToolName -in "Python", "PyPy", "Node", "Go") {
|
||||
}
|
||||
|
||||
if ($ToolName -eq "Xamarin") {
|
||||
$xamarinReleases = "http://aka.ms/manifest/stable"
|
||||
$xamarinReleases = "http://aka.ms/manifest/stable-2022"
|
||||
$xamarinProducts = @(
|
||||
[PSCustomObject] @{name = 'Mono Framework'; property = 'mono-versions'}
|
||||
[PSCustomObject] @{name = 'Xamarin.Android'; property = 'android-versions'}
|
||||
|
||||
@@ -77,6 +77,7 @@ Describe "Build-VersionsManifest" {
|
||||
$assets = @(
|
||||
@{ name = "python-3.8.3-linux-16.04-x64.tar.gz"; browser_download_url = "fake_url"; }
|
||||
@{ name = "python-3.8.3-linux-18.04-x64.tar.gz"; browser_download_url = "fake_url"; }
|
||||
@{ name = "hashes.sha256"; browser_download_url = "fake_url"; }
|
||||
)
|
||||
$configuration = @{
|
||||
regex = "python-\d+\.\d+\.\d+-(\w+)-([\w\.]+)?-?(x\d+)";
|
||||
|
||||
@@ -67,7 +67,7 @@ function Build-VersionsManifest {
|
||||
|
||||
$ltsStatus = Get-VersionLtsStatus -Version $versionKey -LtsRules $ltsRules
|
||||
$stable = $version.PreReleaseLabel ? $false : $true
|
||||
[array]$releaseAssets = $release.assets | ForEach-Object { New-AssetItem -ReleaseAsset $_ -Configuration $Configuration }
|
||||
[array]$releaseAssets = $release.assets | Where { $_.Name -ne "hashes.sha256" } | ForEach-Object { New-AssetItem -ReleaseAsset $_ -Configuration $Configuration }
|
||||
|
||||
$versionHash = [PSCustomObject]@{}
|
||||
$versionHash | Add-Member -Name "version" -Value $versionKey -MemberType NoteProperty
|
||||
|
||||
Reference in New Issue
Block a user