forked from microsoft/ALAppExtensions
-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (42 loc) · 1.5 KB
/
CreateBuildTag.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
});