Skip to content

[main] Create build tag #2874

[main] Create build tag

[main] Create build tag #2874

name: 'Create Build Tag'
on:
workflow_run:
workflows: [' CI/CD']
types: [completed]
branches: [ 'main', 'releases/*' ]
run-name: "[${{ github.ref_name }}] Create build tag"
permissions: read-all
jobs:
CreateTag:
if: github.event.workflow_run.conclusion == 'success'
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
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
});