-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (64 loc) · 2.14 KB
/
cd.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
name: 'CD'
on:
workflow_dispatch:
push:
branches:
- master
- staging
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
prepare:
name: 'Prepare'
uses: rfcx/cicd/.github/workflows/notify-prepare.yaml@master
with:
repo: arbimon-clustering
workflow-id: cd.yaml
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
configure:
name: 'Configure'
runs-on: ubuntu-latest
needs: [prepare]
outputs:
namespace: ${{ steps.configuration.outputs.namespace }}
steps:
- name: 'Conditional environment'
id: configuration
run: |
if [[ "${{ needs.prepare.outputs.branch-name }}" == "master" ]]; then
echo "::set-output name=namespace::production"
elif [[ "${{ needs.prepare.outputs.branch-name }}" == "staging" ]]; then
echo "::set-output name=namespace::staging"
else
echo "::set-output name=namespace::testing"
fi
build:
name: 'Build'
needs: [prepare, configure]
uses: rfcx/cicd/.github/workflows/ecr-build-push.yaml@master
with:
dockerfile: Dockerfile
targets: "[\"arbimon-jobs-clustering\"]"
tag-environment: ${{ needs.configure.outputs.namespace }}
tag-latest: ${{ needs.configure.outputs.namespace == 'production' }}
secrets:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
notify:
name: 'Notify'
if: ${{ always() }}
needs: [prepare, build]
uses: rfcx/cicd/.github/workflows/notify-send.yaml@master
with:
repo: arbimon-clustering
branch-name: ${{ needs.prepare.outputs.branch-name }}
workflow-id: cd.yaml
previous-run-id: ${{ needs.prepare.outputs.previous-run-id }}
status: ${{ needs.deploy.result }}
always: true
notification-title: 'CD: Arbimon Jobs Clustering'
notification-footer: "Build: ${{ needs.build.result || 'n/a' }}"
notification-success-statement: '{0} deployed the build!'
secrets:
slack-webhook: ${{ secrets.SLACK_ALERT_COREDT_WEBHOOK }}
github-token: ${{ secrets.GITHUB_TOKEN }}