-
Notifications
You must be signed in to change notification settings - Fork 8
93 lines (79 loc) · 3.02 KB
/
deploy.yml
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
name: Manual Env Deploy
on:
workflow_dispatch:
inputs:
destination_branch:
type: choice
description: 'Destination environment'
required: true
default: 'stage'
options: ['stage', 'main']
jobs:
version-bump:
uses: ./.github/workflows/version-bump.yml
stage-merge:
if: |
always()
needs: version-bump
runs-on: ubuntu-latest
steps:
- name: Check if user is allowed to execute the workflow
run: |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' && ("${{ github.actor }}" != 'coretex-admin' && "${{ github.actor }}" != 'igorperic17' && "${{ github.actor }}" != 'dule1322' && "${{ github.repository_owner }}" != "${{ github.actor }}" ) ]]; then
echo "::error::You are not authorized to execute this workflow."
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Merge develop into destination branch
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git fetch
git checkout stage
git pull
git pull --rebase origin develop
git push --force
prod-merge:
needs: stage-merge
runs-on: ubuntu-latest
if: ${{ github.event.inputs.destination_branch == 'main' }}
steps:
- name: Check if user is allowed to execute the workflow
run: |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' && ("${{ github.actor }}" != 'coretex-admin' && "${{ github.actor }}" != 'igorperic17' && "${{ github.actor }}" != 'dule1322' && "${{ github.repository_owner }}" != "${{ github.actor }}" ) ]]; then
echo "::error::You are not authorized to execute this workflow."
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Merge develop into destination branch
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git fetch
git checkout main
git pull
git pull --rebase origin stage
git push --force
deploy-pypi:
needs: prod-merge
if: ${{ (github.event.inputs.destination_branch == 'main') && success() }}
uses: ./.github/workflows/python-publish.yml
secrets:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
deploy-docs:
needs: deploy-pypi
if: ${{ (github.event.inputs.destination_branch == 'main') && success() }}
uses: ./.github/workflows/deploy_docs_to_s3.yml
with:
ENVIRONMENT: ${{ github.event.inputs.destination_branch }}
secrets:
AWS_CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }}
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}