-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (40 loc) · 1.77 KB
/
deploy-plugin-main.yml
File metadata and controls
44 lines (40 loc) · 1.77 KB
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
name: Deploy Plugin (PR)
on:
workflow_dispatch:
push:
branches:
- main
paths:
- plugins/*
jobs:
Deploy_Plugin:
runs-on: ubuntu-latest
steps:
- run: |
Write-Output "Deploying Plugin..."
$repoURL = "https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}.git"
Write-Output "Retrieving Git Author......"
$email = git log -1 --pretty=format:'%ae'
$trimmed = $email.Trim()
Write-Output "Commit author determined as $trimmed"
Write-Output "Starting deployment from $repoURL for $trimmed"
try {
$requestBody = @{
"customerRelease" = "true"
"repositoryURL" = $repoURL
"deploymentRequestedBy" = $trimmed
"branchName" = "main"
} | ConvertTo-Json
$authHeader = "Bearer ${{ secrets.DEPLOYER_API_KEY }}"
$deployerUrl = "${{ secrets.DEPLOYER_BASE_URL }}/queuedeployment"
$response = Invoke-RestMethod -Uri $deployerUrl -Method Post -Headers @{Authorization=$authHeader} -Body $requestBody -ContentType "application/json"
Write-Output "Deployment request sent successfully"
Write-Output "Deployment ID: $($response.id)"
} catch {
Write-Output "Failed to deploy plugin"
Write-Output $_.Exception.Message
exit 1
}
shell: pwsh
name: Deploy Plugin
timeout-minutes: 10