-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from im-practices/github-deployments
create-github-deployment
- Loading branch information
Showing
13 changed files
with
146 additions
and
207 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,9 @@ | |
# { "name": "Version", "value": "${{ inputs.tag }}" } | ||
# ] | ||
# secrets: | ||
# MS_TEAMS_URI: ${{ vars.MS_TEAMS_URI }} | ||
# MS_TEAMS_URI: ${{ vars.MS_TEAMS_URI }} | ||
# DEPLOY_NOTIFICATIONS_CHANNEL: ${{ vars.DEPLOY_NOTIFICATIONS_CHANNEL}} | ||
|
||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
|
@@ -68,11 +67,6 @@ on: | |
required: false | ||
type: string | ||
default: 'america/denver' | ||
deployment-board-number: | ||
description: 'The number of the deployment board that should be updated. Defaults to 1.' | ||
required: false | ||
type: number | ||
default: 1 | ||
deployable-type: | ||
description: 'Identifier if there are multiple deployables in the repo, like MFE, DB, API. Defaults to an empty string for single deployables.' | ||
required: false | ||
|
@@ -83,6 +77,11 @@ on: | |
required: false | ||
type: string | ||
default: null | ||
entity: | ||
description: 'The catalog-info.yml metadata.name value for mapping in Tech Hub.' | ||
required: false | ||
type: string | ||
default: null | ||
enable-deployment-slot-tracking: | ||
description: 'Enable App Service deployment slot tracking on deployment board? [true|false]' | ||
required: false | ||
|
@@ -103,6 +102,11 @@ on: | |
type: string | ||
required: false | ||
default: 'production' | ||
instance: | ||
description: 'The instance of the deployment. This is used to create a deployment instance name in the GitHub deployment API.' | ||
required: false | ||
type: string | ||
default: null | ||
custom-facts-for-team-channel: | ||
description: The custom facts that will be included in the post in the team's channel. By default Workflow, Run, Actor and Version are included. | ||
required: false | ||
|
@@ -129,23 +133,18 @@ jobs: | |
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update deployment board | ||
if: always() | ||
uses: im-open/[email protected] | ||
# Only run this step if Tech Hub metadata.name value is passed in | ||
- name: Create GitHub Deployment | ||
if: ${{ inputs.entity != null }} | ||
uses: im-open/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow-actor: ${{ github.actor }} # This will add the user who kicked off the workflow to the deployment payload | ||
token: ${{ secrets.GITHUB_TOKEN }} # Special per-job token generated by GH for interacting with the repo | ||
environment: ${{ inputs.deployment-environment }} | ||
board-number: ${{ inputs.deployment-board-number }} | ||
ref: ${{ inputs.release-tag }} | ||
ref-type: 'tag' | ||
deployable-type: ${{ inputs.deployable-type }} | ||
deploy-label: ${{ inputs.deployable-label }} | ||
deploy-status: ${{ steps.conclusion.outputs.workflow_conclusion }} | ||
enable-deployment-slot-tracking: ${{ inputs.enable-deployment-slot-tracking }} | ||
slot-swapped-with-production-slot: ${{ inputs.slot-swapped-with-production-slot }} | ||
target-slot: ${{ inputs.target-slot }} | ||
source-slot: ${{ inputs.source-slot }} | ||
timezone: ${{ inputs.timezone }} | ||
release-ref: ${{ inputs.release-tag }} | ||
deployment-status: ${{ steps.conclusion.outputs.workflow_conclusion }} | ||
entity: ${{ inputs.entity }} | ||
instance: ${{ inputs.instance || inputs.target-slot }} | ||
|
||
- name: Configure facts for team's notification channel | ||
if: always() | ||
|
@@ -156,7 +155,7 @@ jobs: | |
const rawFacts = process.env.FACTS; | ||
console.log(`"${rawFacts}"`); | ||
let facts = rawFacts && rawFacts.trim().length > 0 ? JSON.parse(rawFacts) : null; | ||
if (!facts || facts.length === 0){ | ||
console.log(`Custom facts were not provided for the Team's Notification channel, use the default facts:`); | ||
facts = [ | ||
|
@@ -174,7 +173,7 @@ jobs: | |
core.setOutput('facts', facts); | ||
env: | ||
FACTS: ${{ inputs.custom-facts-for-team-channel }} | ||
|
||
- name: Send status to team's notification channel | ||
if: always() | ||
uses: im-open/[email protected] | ||
|
@@ -195,9 +194,9 @@ jobs: | |
const postInProd = ${{ inputs.post-status-in-deployment-notifications-channel }}; | ||
const deployEnv = '${{ inputs.deployment-environment }}'; | ||
const workflowConclusion = '${{ steps.conclusion.outputs.workflow_conclusion }}'; | ||
const isProdEnv = deployEnv === 'prod' || deployEnv === 'prod-secondary'; | ||
const post = postInProd && isProdEnv && workflowConclusion === 'success'; | ||
core.setOutput('post', post); | ||
|
@@ -221,7 +220,7 @@ jobs: | |
script: | | ||
const rawFacts = process.env.FACTS; | ||
let facts = rawFacts && rawFacts.trim().length > 0 ? JSON.parse(rawFacts) : null; | ||
if (!facts || facts.length === 0){ | ||
console.log('Custom facts were not provided for the Deployment Notifications channel, use the default facts:'); | ||
facts = [ | ||
|
@@ -237,7 +236,7 @@ jobs: | |
core.setOutput('facts', facts); | ||
env: | ||
FACTS: ${{ inputs.custom-facts-for-deployment-notifications-channel }} | ||
|
||
- name: Send Status to Deployment Notifications Channel for Prod Deploys | ||
if: always() && steps.post-to-deployment-channel.outputs.post == 'true' | ||
uses: im-open/[email protected] | ||
|
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
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
5 changes: 0 additions & 5 deletions
5
workflow-templates/im-deploy-cleanup-automated-board.properties.json
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.