-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.88 KB
/
config_push_preview_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
# This workflow will be triggered on every merge on the main branch
# Note : if the asyncapi file is not present, the job is canceled
# To get started, configure the following in your repos secrets https://docs.github.com/en/actions/security-guides/encrypted-secrets
# SOLACE_CLOUD_TOKEN: Solace Cloud Token
name: Config Push Deploy
on:
push:
branches: [ main ]
env:
EVENT_MESH_NAME: us-central-solace-Prod
jobs:
config-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Get asyncapi file in the commit
id: changed_files
uses: tj-actions/changed-files@v40
with:
files: |
asyncapi*
- name: Read asyncapi content
id: asyncapi
run: |
for file in ${{ steps.changed_files.outputs.all_changed_files }}; do
if [[ ( ${file} == *.yaml ) || ( ${file} == *.yml ) || ( ${file} == *.json ) ]]
then
echo 'asyncFile<<EOF' >> $GITHUB_OUTPUT
echo $(cat $file) >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
fi
done
- name: Extract Application Version ID from asyncapiFile
if: ${{ steps.asyncapi.outputs.asyncFile }}
uses: tmelliottjr/extract-regex-action@v1.4.0
id: epApplicationVersionId
with:
regex: '(?<=x-ep-application-version-id\\": \\")(.*?)(?=\\")'
flags: "gm"
input: ${{steps.asyncapi.outputs.asyncFile}}
- name: Promote Application Version
if: ${{ steps.epApplicationVersionId.outputs.resultString }}
uses: SolaceDev/solace-ep-config-push@v0.1.0
with:
SOLACE_CLOUD_TOKEN: ${{ secrets.SOLACE_CLOUD_TOKEN }}
APPLICATION_VERSION_ID: ${{ steps.epApplicationVersionId.outputs.resultString }}
EVENT_MESH_NAME: ${{ env.EVENT_MESH_NAME }}