[main] Create build tag #282
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
name: 'Create Build Tag' | |
on: | |
workflow_run: | |
workflows: [' CI/CD'] | |
types: [completed] | |
branches: ['main'] | |
run-name: "[${{ github.ref_name }}] Create build tag" | |
permissions: | |
contents: write | |
jobs: | |
CreateTag: | |
if: github.event.workflow_run.conclusion == 'success' | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get Build Version | |
id: GetBuildVersion | |
env: | |
buildNumber: ${{ github.event.workflow_run.run_number }} | |
run: | | |
Import-Module ".\build\scripts\EnlistmentHelperFunctions.psm1" | |
$majorMinor = Get-ConfigValue -ConfigType "AL-GO" -Key RepoVersion | |
$buildVersion = "$($majorMinor).$($env:buildNumber)" | |
Write-Host "Build Version: $buildVersion" | |
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "BuildVersion=$buildVersion" | |
- name: Create version tag | |
uses: actions/github-script@v6 | |
env: | |
BuildVersion: ${{ steps.GetBuildVersion.outputs.BuildVersion}} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const {BuildVersion} = process.env | |
const tag = `refs/tags/builds/${BuildVersion}` | |
console.log(`Creating tag: ${tag}`) | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: tag, | |
sha: context.sha | |
}); |