mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 19:50:24 +00:00
New parser for xamarin and python. Reworked workflow with composite actions (#41)
This commit is contained in:
39
.github/actions/send-slack-notification/action.yml
vendored
Normal file
39
.github/actions/send-slack-notification/action.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: 'Send Slack notification'
|
||||
description: 'SendSlack notification about new versions of a tool'
|
||||
inputs:
|
||||
url:
|
||||
required: true
|
||||
description: 'Slack channel url'
|
||||
tool-name:
|
||||
required: true
|
||||
description: 'Name of a tool to send notification for. Like Xamarin or Python'
|
||||
default: 'Xamarin'
|
||||
tool-version:
|
||||
required: false
|
||||
description: 'New versions of a tool'
|
||||
pipeline-url:
|
||||
required: false
|
||||
description: 'Url of a pipeline'
|
||||
image-url:
|
||||
required: false
|
||||
description: 'Image url for message'
|
||||
default: 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
|
||||
text:
|
||||
required: false
|
||||
description: 'Message text'
|
||||
add-to-toolset-flag:
|
||||
required: false
|
||||
description: 'Flag to use notification for adding new versions to toolset'
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- id: send-slack-notification
|
||||
name: Send Slack notification
|
||||
shell: pwsh
|
||||
run: ./get-new-tool-versions/send-slack-notification.ps1 -Url "${{ inputs.url }}" `
|
||||
-ToolName "${{ inputs.tool-name }}" `
|
||||
-ToolVersion "${{ inputs.tool-version }}" `
|
||||
-PipelineUrl "${{ inputs.pipeline-url }}" `
|
||||
-ImageUrl "${{ inputs.image-url }}" `
|
||||
-Text "${{ inputs.text }}" `
|
||||
${{ inputs.add-to-toolset-flag }}
|
||||
82
.github/workflows/get-tools-new-versions.yml
vendored
Normal file
82
.github/workflows/get-tools-new-versions.yml
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
name: Get tools new versions
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 8 * * THU'
|
||||
workflow_dispatch:
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
|
||||
jobs:
|
||||
find-new-xamarin-versions:
|
||||
name: Searching for new Xamarin versions
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
versions-output: ${{ steps.get-new-xamarin-versions.outputs.versions-output }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: get-new-xamarin-versions
|
||||
name: Get new Xamarin versions
|
||||
run: echo "::set-output name=versions-output::$(./get-new-tool-versions/verify-new-tool-version-added-to-image.ps1 -ToolName Xamarin)"
|
||||
|
||||
check-new-xamarin-versions:
|
||||
name: Verifying new Xamarin versions exist
|
||||
runs-on: ubuntu-latest
|
||||
needs: find-new-xamarin-versions
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Check Versions
|
||||
if: needs.find-new-xamarin-versions.outputs.versions-output == ''
|
||||
run: Write-Host "No new versions found"
|
||||
- uses: ./.github/actions/send-slack-notification
|
||||
if: needs.find-new-xamarin-versions.outputs.versions-output != ''
|
||||
with:
|
||||
url: ${{ secrets.SLACK_CHANNEL_URL }}
|
||||
tool-name: 'Xamarin'
|
||||
tool-version: ${{ needs.find-new-xamarin-versions.outputs.versions-output }}
|
||||
image-url: 'https://avatars.githubusercontent.com/u/790012?s=200&v=4'
|
||||
add-to-toolset-flag: '-AddToToolsetFlag'
|
||||
|
||||
find-new-python-versions:
|
||||
name: Searching for new Python versions
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
versions-output: ${{ steps.get-new-python-versions.outputs.versions-output }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- id: get-new-python-versions
|
||||
name: Get new Python versions
|
||||
run: echo "::set-output name=versions-output::$(./get-new-tool-versions/verify-new-tool-version-added-to-image.ps1 -ToolName Python)"
|
||||
|
||||
check-new-python-versions:
|
||||
name: Verifying new Python versions exist
|
||||
runs-on: ubuntu-latest
|
||||
needs: find-new-python-versions
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Check Versions
|
||||
if: needs.find-new-python-versions.outputs.versions-output == ''
|
||||
run: Write-Host "No new versions found"
|
||||
- uses: ./.github/actions/send-slack-notification
|
||||
if: needs.find-new-python-versions.outputs.versions-output != ''
|
||||
with:
|
||||
url: ${{ secrets.SLACK_CHANNEL_URL }}
|
||||
tool-name: 'Python'
|
||||
tool-version: ${{ needs.find-new-python-versions.outputs.versions-output }}
|
||||
image-url: 'https://www.python.org/static/community_logos/python-powered-h-100x130.png'
|
||||
add-to-toolset-flag: '-AddToToolsetFlag'
|
||||
|
||||
check_build:
|
||||
name: Check build for failures
|
||||
runs-on: ubuntu-latest
|
||||
needs: [check-new-xamarin-versions, check-new-python-versions]
|
||||
if: failure()
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./.github/actions/send-slack-notification
|
||||
with:
|
||||
url: ${{ secrets.SLACK_CHANNEL_URL }}
|
||||
tool-name: 'Python or Xamarin'
|
||||
pipeline-url: '$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID'
|
||||
text: "The build of the Xamarin or Python detection pipeline has failed stages:"
|
||||
69
.github/workflows/get-xamarin-versions.yml
vendored
69
.github/workflows/get-xamarin-versions.yml
vendored
@@ -1,69 +0,0 @@
|
||||
name: Get Xamarin versions
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 8 * * THU'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
TOOL_NAME: "Xamarin"
|
||||
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@v2
|
||||
|
||||
- id: Get_new_versions
|
||||
name: Get new versions
|
||||
run: ./get-new-tool-versions/get-new-tool-versions.ps1 -ToolName ${{ env.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@v2
|
||||
|
||||
- name: Check Versions
|
||||
if: success() && env.TOOL_VERSIONS == ''
|
||||
run: |
|
||||
Write-Host "No new versions were found"
|
||||
Import-Module "./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: |
|
||||
$message = "The following versions of '${{ env.TOOL_NAME }}' are available, consider adding them to toolset: ${{ env.TOOL_VERSIONS }}"
|
||||
./get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
|
||||
-ToolName "${{ env.TOOL_NAME }}" `
|
||||
-ImageUrl "https://avatars.githubusercontent.com/u/790012?s=200&v=4" `
|
||||
-Text "$message"
|
||||
|
||||
check_build:
|
||||
name: Check build for failures
|
||||
runs-on: ubuntu-latest
|
||||
needs: [find_new_versions, check_new_versions]
|
||||
if: failure()
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- 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 '${{ env.TOOL_NAME }}' detection pipeline failed :progress-error:\nLink to the pipeline: $pipelineUrl"
|
||||
./get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
|
||||
-ToolName "${{ env.TOOL_NAME }}" `
|
||||
-Text "$message" `
|
||||
-ImageUrl "https://avatars.githubusercontent.com/u/790012?s=200&v=4"
|
||||
Reference in New Issue
Block a user