Add LinearB deployment workflow #1
Workflow file for this run
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: 'LinearB Deployment' | |
on: | |
pull_request: | |
branches: [main] | |
paths-ignore: ["*.md"] | |
workflow_call: | |
inputs: | |
environment: | |
required: true | |
type: string | |
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 |