Skip to content

Commit

Permalink
Support for Pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasArdal committed Jul 17, 2024
1 parent 1fda1a2 commit fd88a9f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 14 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ jobs:
uses: onlyutkarsh/patch-files-action@v1.0.3
with:
files: vss-extension.json
patch-syntax: = /version => "3.3.${{ github.run_number }}"
patch-syntax: = /version => "4.0.${{ github.run_number }}"
fail-if-no-files-patched: true

- name: Patch task.json
uses: onlyutkarsh/patch-files-action@v1.0.3
with:
files: ElmahIoDeploymentNotification/task.json
patch-syntax: |
= /version/Major => "3"
= /version/Minor => "3"
= /version/Major => "4"
= /version/Minor => "0"
= /version/Patch => "${{ github.run_number }}"
fail-if-no-files-patched: true

Expand All @@ -55,8 +55,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: 3.3.${{ github.run_number }}
release_name: Release 3.3.${{ github.run_number }}
tag_name: 4.0.${{ github.run_number }}
release_name: Release 4.0.${{ github.run_number }}
draft: false

- name: Upload vsix
Expand All @@ -66,6 +66,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./elmahio.deploy-tasks-3.3.${{ github.run_number }}.vsix
asset_name: elmahio.deploy-tasks-3.3.${{ github.run_number }}.vsix
asset_path: ./elmahio.deploy-tasks-4.0.${{ github.run_number }}.vsix
asset_name: elmahio.deploy-tasks-4.0.${{ github.run_number }}.vsix
asset_content_type: application/zip
36 changes: 36 additions & 0 deletions ElmahIoDeploymentNotification/notify.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,42 @@ Trace-VstsEnteringInvocation $MyInvocation
$apiKey = Get-VstsInput -Name "apiKey" -Require
$logId = Get-VstsInput -Name "logId"
$version = Get-VstsInput -Name "version" -Require
$description = ""
$userName = ""
$userEmail = ""

if ($Env:RELEASE_RELEASENAME) {
if (-not $version) {
$version = $Env:RELEASE_RELEASENAME
}
$description = $Env:RELEASE_RELEASEDESCRIPTION
$userName = $Env:RELEASE_REQUESTEDFOR
} else {
if (-not $version) {
$version = $Env:BUILD_BUILDNUMBER
}
$description = $BUILD_SOURCEVERSIONMESSAGE
$userName = $BUILD_SOURCEVERSIONAUTHOR
$userEmail = $BUILD_SOURCEVERSIONAUTHOREMAIL
if (-not $userEmail) {
$userEmail = $(git log -1 --pretty=format:'%ae')
}
}

if (-not $version) {
if ($Env:RELEASE_RELEASENAME) {
$version = $Env:RELEASE_RELEASENAME
} else {
$version = $Env:BUILD_BUILDNUMBER
}
}

$userName = ""
if ($Env:RELEASE_REQUESTEDFOR) {
userName = $Env:RELEASE_REQUESTEDFOR
} else {
userName = $BUILD_SOURCEVERSIONAUTHOR
}

$ProgressPreference = "SilentlyContinue"
$url = 'https://api.elmah.io/v3/deployments?api_key=' + $apiKey
Expand Down
12 changes: 6 additions & 6 deletions ElmahIoDeploymentNotification/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
],
"author": "elmah.io",
"version": {
"Major": 3,
"Minor": 2,
"Patch": 3
"Major": 4,
"Minor": 0,
"Patch": 0
},
"demands": [],
"minimumAgentVersion": "1.104.0",
Expand All @@ -36,9 +36,9 @@
"name": "version",
"type": "string",
"label": "Version",
"defaultValue": "$Env:RELEASE_RELEASENAME",
"required": true,
"helpMarkDown": "Override to pick a custom naming scheme for your versions. Must be a valid PowerShell string."
"defaultValue": "",
"required": false,
"helpMarkDown": "Override to pick a custom naming scheme for your versions. If not specified, the task will use RELEASE_RELEASENAME for releases and BUILD_BUILDNUMBER for pipelines."
}
],
"instanceNameFormat": "elmah.io Deployment Notification $(project)",
Expand Down
2 changes: 1 addition & 1 deletion vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "deploy-tasks",
"name": "elmah.io Deployment Tasks",
"version": "3.2.3",
"version": "4.0.0",
"publisher": "elmahio",
"tags": [
"Error",
Expand Down

0 comments on commit fd88a9f

Please sign in to comment.