2021-08-17 14:12:11 +00:00
|
|
|
name: Get Go versions
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 3,15 * * *'
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
env:
|
|
|
|
TOOL_NAME: "Go"
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: pwsh
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
find_new_versions:
|
|
|
|
name: Find new versions
|
2021-08-20 14:33:06 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-08-17 14:12:11 +00:00
|
|
|
outputs:
|
2021-08-20 14:33:06 +00:00
|
|
|
versions_output: ${{ steps.Get_new_versions.outputs.TOOL_VERSIONS }}
|
2021-08-17 14:12:11 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
2021-08-20 14:33:06 +00:00
|
|
|
|
2021-08-17 14:12:11 +00:00
|
|
|
- id: Get_new_versions
|
|
|
|
name: Get new versions
|
|
|
|
run: ./helpers/get-new-tool-versions/get-new-tool-versions.ps1 -ToolName ${{ env.TOOL_NAME }}
|
|
|
|
|
|
|
|
check_new_versions:
|
|
|
|
name: Check new versions
|
2021-08-20 14:33:06 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-08-17 14:12:11 +00:00
|
|
|
needs: find_new_versions
|
|
|
|
env:
|
|
|
|
TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
2021-08-20 14:33:06 +00:00
|
|
|
|
2021-08-17 14:12:11 +00:00
|
|
|
- name: Check Versions
|
2021-08-20 14:33:06 +00:00
|
|
|
if: env.TOOL_VERSIONS == ''
|
2021-08-17 14:12:11 +00:00
|
|
|
run: |
|
|
|
|
Write-Host "No new versions were found"
|
|
|
|
Import-Module "./helpers/github/github-api.psm1"
|
|
|
|
$gitHubApi = Get-GitHubApi -RepositoryFullName "$env:GITHUB_REPOSITORY" `
|
|
|
|
-AccessToken "${{ secrets.PERSONAL_TOKEN }}"
|
2021-08-20 14:33:06 +00:00
|
|
|
|
2021-08-17 14:12:11 +00:00
|
|
|
$gitHubApi.CancelWorkflow("$env:GITHUB_RUN_ID")
|
|
|
|
Start-Sleep -Seconds 60
|
2021-08-20 14:33:06 +00:00
|
|
|
|
2021-08-17 14:12:11 +00:00
|
|
|
- name: Send Slack notification
|
|
|
|
run: |
|
2021-08-20 14:33:06 +00:00
|
|
|
$pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
|
2021-08-25 12:29:09 +00:00
|
|
|
$message = "The following versions of '${{ env.TOOL_NAME }}' are available to upload: ${{ env.TOOL_VERSIONS }}\nLink to the pipeline: $pipelineUrl"
|
2021-08-17 14:12:11 +00:00
|
|
|
./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
|
|
|
|
-ToolName "${{ env.TOOL_NAME }}" `
|
2021-08-25 12:29:09 +00:00
|
|
|
-ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" `
|
|
|
|
-Text "$message"
|
2021-08-17 14:12:11 +00:00
|
|
|
trigger_builds:
|
|
|
|
name: Trigger builds
|
2021-08-20 14:33:06 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-08-17 14:12:11 +00:00
|
|
|
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@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
2021-08-20 14:33:06 +00:00
|
|
|
|
2021-08-17 14:12:11 +00:00
|
|
|
- name: Trigger "Build go packages" workflow
|
|
|
|
run:
|
|
|
|
./helpers/github/run-ci-builds.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" `
|
|
|
|
-AccessToken "${{ secrets.PERSONAL_TOKEN }}" `
|
|
|
|
-WorkflowFileName "build-go-packages.yml" `
|
|
|
|
-WorkflowDispatchRef "main" `
|
|
|
|
-ToolVersions "${{ env.TOOL_VERSIONS }}" `
|
|
|
|
-PublishReleases "true"
|
2021-08-19 13:16:05 +00:00
|
|
|
|
|
|
|
check_build:
|
|
|
|
name: Check build for failures
|
2021-08-20 14:33:06 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-08-19 13:16:05 +00:00
|
|
|
needs: [find_new_versions, check_new_versions, trigger_builds]
|
|
|
|
if: failure()
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
|
|
|
- name: Send Slack notification if build fails
|
|
|
|
run: |
|
2021-08-20 14:33:06 +00:00
|
|
|
$pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
|
2021-08-25 12:29:09 +00:00
|
|
|
$message = "The build of the '${{ env.TOOL_NAME }}' detection pipeline failed :progress-error:\nLink to the pipeline: $pipelineUrl"
|
2021-08-19 13:16:05 +00:00
|
|
|
./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
|
|
|
|
-ToolName "${{ env.TOOL_NAME }}" `
|
2021-08-25 12:29:09 +00:00
|
|
|
-Text "$message" `
|
2021-08-19 13:16:05 +00:00
|
|
|
-ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg"
|