-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (127 loc) · 4.8 KB
/
former_build_deploy_to_prod.yaml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: 'Deploy former build to PROD'
# Action that will download previously created artifact and deploy it to the production environment
on:
workflow_dispatch:
# We need the Github Action Run number to select which artifact to download
inputs:
gh_run_number:
description: 'The Github Action run number to deploy'
required: true
jobs:
deploy-artifact:
name: 'Deploy artifact'
runs-on: ubuntu-latest
environment: 'production'
steps:
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v6
with:
workflow: deploy_to_prod.yaml
branch: master
run_number: ${{ github.event.inputs.gh_run_number }}
- name: display downloads
run: ls -R
- id: deploy_app_to_XP
uses: 'enonic/action-app-deploy@main'
with:
# Secrets from Github repository
url: ${{ secrets.ENONIC_PROD_URL }}
username: ${{ secrets.ENONIC_USER }}
password: ${{ secrets.ENONIC_PROD_PASS }}
client_cert: ${{ secrets.ENONIC_CERT }}
client_key: ${{ secrets.ENONIC_KEY }}
app_jar: "*.jar"
- name: Get Version Number
id: get_version_number
run: |
VERSION=$(awk -F' = ' '/^version/ {print $2}' ./gradle.properties)
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Create tag and release
id: tag_and_release
run: gh release create $VERSION --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Send success message to Slack
id: slack_success
if: success()
uses: slackapi/slack-github-action@v1
with:
# Using Github block kit (https://api.slack.com/reference/block-kit/blocks) to configure the Slack message, see https://docs.github.com/en/actions/learn-github-actions/contexts
# for more information about context variables
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ github.workflow }} in ${{ github.repository }}"
}
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"alt_text" : "Github logo"
},
{
"type": "mrkdwn",
"text": "Run by: *${{ github.actor }}* on: *${{ github.ref_name }}*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "🛠 Build ${{ github.event.inputs.gh_run_number }} is a *${{ job.status }}*, well done!\n<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|workflow output>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERTS_PROD }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Send failure message to Slack
id: slack_failure
if: failure()
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ github.workflow }} in ${{ github.repository }}"
}
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"alt_text" : "Github logo"
},
{
"type": "mrkdwn",
"text": "Run by: *${{ github.actor }}* on: *${{ github.ref_name }}*"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "💣 Build ${{ github.event.inputs.gh_run_number }} is a *${{ job.status }}*, and that's cool!\nIf you want to fix it, start by looking at the <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|workflow output>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_MIMIR_UTV }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK