-
-
Notifications
You must be signed in to change notification settings - Fork 1
179 lines (148 loc) · 5.56 KB
/
production-on-push-build-and-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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Build and Deploy to Production
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
upload_raml:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./scripts/requirements.txt
- name: Execute exchange-update.py with secrets
env:
ORGANIZATION_ID: ${{ secrets.EXCHANGE_UPDATE_ORGANIZATION_ID }}
API_MANAGER_ENVIRONMENT_ID: ${{ secrets.PRODUCTION_EXCHANGE_UPDATE_API_MANAGER_ENVIRONMENT_ID }}
API_MANAGER_INSTANCE_ID: ${{ secrets.PRODUCTION_EXCHANGE_UPDATE_API_MANAGER_INSTANCE_ID }}
CLIENT_ID: ${{ secrets.EXCHANGE_UPDATE_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.EXCHANGE_UPDATE_CLIENT_SECRET }}
run: |
cd scripts
python exchange-update.py $ORGANIZATION_ID $API_MANAGER_ENVIRONMENT_ID $API_MANAGER_INSTANCE_ID $CLIENT_ID $CLIENT_SECRET
build_mule:
needs: upload_raml
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: Set up script permissions
run: chmod +x ./scripts/deployment-build.sh
- name: Set up script permissions 2
run: chmod +x ./scripts/disable-validations.sh
- name: Disable validations & execute deployment-build.sh with secrets
env:
KEYSTORE_KEY_PASSWORD: ${{ secrets.PRODUCTION_KEYSTORE_KEY_PASSWORD }}
KEYSTORE_PASSWORD: ${{ secrets.PRODUCTION_KEYSTORE_PASSWORD }}
run: |
cd scripts
./disable-validations.sh
./deployment-build.sh $KEYSTORE_KEY_PASSWORD $KEYSTORE_PASSWORD
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: artifacts
path: ./target/*.jar
deploy_mule:
needs: build_mule
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cache Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: artifacts
path: .
# - name: Print effective-settings
# run: mvn help:effective-settings
- name: Deploy to Production
run: |
artifactName=$(ls *.jar | head -1)
echo "Deploying artifact $artifactName to the Production environment."
mvn deploy -DmuleDeploy -e -Dmule.artifact=$artifactName \
-Danypoint.username="${{ secrets.ANYPOINT_CICD_USERNAME }}" \
-Danypoint.password="${{ secrets.ANYPOINT_CICD_PASSWORD }}" \
-Dapp.name=production-salesforce-data-api \
-Denv=Production \
-Denv.lowercase=production \
-Dapi.id="${{ secrets.PRODUCTION_API_ID }}" \
-Dkeystore.key.password="${{ secrets.PRODUCTION_KEYSTORE_KEY_PASSWORD }}" \
-Dkeystore.password="${{ secrets.PRODUCTION_KEYSTORE_PASSWORD }}" \
-Danypoint.platform.client_id="${{ secrets.ANYPOINT_PLATFORM_CLIENT_ID }}" \
-Danypoint.platform.client_secret="${{ secrets.ANYPOINT_PLATFORM_CLIENT_SECRET }}" \
-Dsfdc.password="${{ secrets.SFDC_PROD_INTEGRATIONUSER_PWD }}" \
-Dsfdc.tkn="${{ secrets.SFDC_PROD_INTEGRATIONUSER_TKN }}" \
-Dtypeform.clientid="${{ secrets.TYPEFORM_CLIENTID }}" \
-Dtypeform.clientsecret="${{ secrets.TYPEFORM_CLIENTSECRET }}" \
-Dtypeform.tkn="${{ secrets.TYPEFORM_TKN }}" \
-DskipTests
- name: Confirm Deployment
run: |
echo "Deployment to Sandbox completed."
create-release:
needs: deploy_mule
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Execute version.sh to determine new tag
id: determine_version
run: |
chmod +x ./scripts/version.sh
new_tag=$(./scripts/version.sh)
echo "::set-output name=new_tag::$new_tag"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.determine_version.outputs.new_tag }}
release_name: Release ${{ steps.determine_version.outputs.new_tag }}
body: "Release of the production-salesforce-data-api"
draft: false
prerelease: false
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: artifacts
path: .
- name: Capture artifact file path
id: get_file
run: echo "FILE_PATH=$(ls ./*.jar)" >> $GITHUB_ENV
- name: Upload artifact to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.FILE_PATH }}
asset_name: production-salesforce-data-api-${{ steps.determine_version.outputs.new_tag }}.jar
asset_content_type: application/java-archive