Update get-go-versions forkflow

This commit is contained in:
Nikita Bykov 2021-08-20 17:33:06 +03:00
parent c8892db080
commit d0f2864c56

View file

@ -13,20 +13,21 @@ defaults:
jobs: jobs:
find_new_versions: find_new_versions:
name: Find new versions name: Find new versions
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
outputs: outputs:
versions_output: ${{ steps.Get_new_versions.outputs.version_number }} versions_output: ${{ steps.Get_new_versions.outputs.TOOL_VERSIONS }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- id: Get_new_versions - id: Get_new_versions
name: Get new versions name: Get new versions
run: ./helpers/get-new-tool-versions/get-new-tool-versions.ps1 -ToolName ${{ env.TOOL_NAME }} run: ./helpers/get-new-tool-versions/get-new-tool-versions.ps1 -ToolName ${{ env.TOOL_NAME }}
check_new_versions: check_new_versions:
name: Check new versions name: Check new versions
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
needs: find_new_versions needs: find_new_versions
env: env:
TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}} TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}}
@ -34,27 +35,30 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- name: Check Versions - name: Check Versions
if: success() && env.TOOL_VERSIONS == '' if: env.TOOL_VERSIONS == ''
run: | run: |
Write-Host "No new versions were found" Write-Host "No new versions were found"
Import-Module "./helpers/github/github-api.psm1" Import-Module "./helpers/github/github-api.psm1"
$gitHubApi = Get-GitHubApi -RepositoryFullName "$env:GITHUB_REPOSITORY" ` $gitHubApi = Get-GitHubApi -RepositoryFullName "$env:GITHUB_REPOSITORY" `
-AccessToken "${{ secrets.PERSONAL_TOKEN }}" -AccessToken "${{ secrets.PERSONAL_TOKEN }}"
$gitHubApi.CancelWorkflow("$env:GITHUB_RUN_ID") $gitHubApi.CancelWorkflow("$env:GITHUB_RUN_ID")
Start-Sleep -Seconds 60 Start-Sleep -Seconds 60
- name: Send Slack notification - name: Send Slack notification
run: | run: |
$PipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" $pipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID"
./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" ` ./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
-ToolName "${{ env.TOOL_NAME }}" ` -ToolName "${{ env.TOOL_NAME }}" `
-ToolVersion "${{ env.TOOL_VERSIONS }}" ` -ToolVersion "${{ env.TOOL_VERSIONS }}" `
-PipelineUrl "$PipelineUrl" ` -PipelineUrl "$pipelineUrl" `
-ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg"
trigger_builds: trigger_builds:
name: Trigger builds name: Trigger builds
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
needs: [find_new_versions, check_new_versions] needs: [find_new_versions, check_new_versions]
env: env:
TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}} TOOL_VERSIONS: ${{needs.find_new_versions.outputs.versions_output}}
@ -63,6 +67,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- name: Trigger "Build go packages" workflow - name: Trigger "Build go packages" workflow
run: run:
./helpers/github/run-ci-builds.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" ` ./helpers/github/run-ci-builds.ps1 -RepositoryFullName "$env:GITHUB_REPOSITORY" `
@ -74,7 +79,7 @@ jobs:
check_build: check_build:
name: Check build for failures name: Check build for failures
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
needs: [find_new_versions, check_new_versions, trigger_builds] needs: [find_new_versions, check_new_versions, trigger_builds]
if: failure() if: failure()
steps: steps:
@ -84,10 +89,9 @@ jobs:
- name: Send Slack notification if build fails - name: Send Slack notification if build fails
run: | run: |
$PipelineUrl = "$env:GITHUB_SERVER_URL/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID" $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" $Message = "The build of the '${{ env.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 }}" ` ./helpers/get-new-tool-versions/send-slack-notification.ps1 -Url "${{ secrets.SLACK_CHANNEL_URL }}" `
-ToolName "${{ env.TOOL_NAME }}" ` -ToolName "${{ env.TOOL_NAME }}" `
-Text "$Message" ` -Text "$Message" `
-ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg" -ImageUrl "https://golang.org/lib/godoc/images/footer-gopher.jpg"