-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (35 loc) · 1.28 KB
/
linearb-deployment.yml
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
name: 'LinearB Deployment'
on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
LINEARB_APIKEY:
required: true
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: 'Report LinearB Deployment'
shell: pwsh
run: |
Write-Host "$(Get-Date -Format "hh:mm:ss")" 'STARTING LinearB Deployment'
$datetime = Get-Date -Format 'yyyy-MM-ddTHH:mm:ssZ'
$stage = "${{ inputs.environment }}".ToLowerInvariant()
$RepositoryUrl = "${{ github.repositoryUrl }}" -replace "^git://", "https://"
$data = @"
{
"repo_url": "$RepositoryUrl",
"ref_name": "${{github.sha}}",
"timestamp": "$datetime",
"stage": "$stage"
}
"@
Write-Host "data ###########################################################"
Write-Host $data
Write-Host "Web Request ###########################################################"
$response = Invoke-WebRequest "https://public-api.linearb.io/api/v1/deployments" -Headers @{"x-api-key"= "${{ secrets.LINEARB_APIKEY }}"} -ContentType "application/json" -Body "$data" -Method Post
Write-Host "response ##################################################"
Write-Host $response