Repository navigation
95 lines (92 loc) · 3.59 KB
/
Copy pathcommit-development.yml
File metadata and controls
95 lines (92 loc) · 3.59 KB
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
# ------------------------------------------------------------------------------
# Github Workflow to commit to development branch ...
#
# - This pipeline is triggered manually by developers at various times
#
# 1) Run predefined tests for this project in wM.io DEV environment
# - Calls workflow postman-validation to perform tests
#
# 2) Only if validation successful:
# - Check out development branch
# - Run an export of all dev assets for this project in wM.io
# - Perform a commit/push to git origin for this development branch
#
# ------------------------------------------------------------------------------
name: Commit Development
on:
workflow_call:
inputs:
environment:
type: string
required: true
secrets:
WMIO_PASSWORD:
required: true
jobs:
# -------------------------------
# Export and Commit if test success
# -------------------------------
Dev-Assets:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
# --------------------------------------
# Check out project development branch
# --------------------------------------
- uses: actions/checkout@v4
with:
ref: 'development'
# --------------------------------------
# Check out DevOps scripts
# --------------------------------------
- uses: actions/checkout@v4
with:
repository: 'HMHansson/ICA-DevOps'
path: "devops"
# --------------------------------------
# Build Info
# --------------------------------------
- name: Build Info
run: |
echo Repository: ${{ github.repository }}
echo Project Name: ${{ vars.WMIO_PROJECT_NAME }}
echo Environment: ${{ inputs.environment }}
echo Run ID: ${{ github.run_id }}
echo Run Number: ${{ github.run_number }}
echo Triggered by: ${{ github.triggering_actor }}
echo Github path: ${{ github.workspace }}
echo webMethods.io URL: https://${{ vars.WMIO_HOSTNAME }}:443
echo webMethods.io Username: ${{ vars.WMIO_USERNAME }}
echo Triggered by : ${{ github.event_name }}
# --------------------------------------
# Export All Assets
# --------------------------------------
- name: Export All Assets
run: |
PROJECT_NAME_URL_ENCODED=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${{ vars.WMIO_PROJECT_NAME }}")
chmod +x ${{ github.workspace }}/devops/scripts/*.sh
${{ github.workspace }}/devops/scripts/exportAllAssets.sh \
https://${{ vars.WMIO_HOSTNAME }}:443 \
${{ vars.WMIO_USERNAME }} \
"${{ secrets.WMIO_PASSWORD }}" \
${PROJECT_NAME_URL_ENCODED} \
${{ github.workspace }}
# --------------------------------------
# List Exported Assets
# --------------------------------------
- name: List Exported Assets
run: |
ASSETS_DIR="${{ github.workspace }}/assets"
ls -ltr "${ASSETS_DIR}"
# -------------------------------
# Commmit all updated assets to Dev Branch
# -------------------------------
- name: Commmit & Push Dev Branch
run: |
cd "${{ github.workspace }}"
git config user.email "noemail.com"
git config user.name "${{ github.triggering_actor }}"
git add .
git commit -m "${{ github.triggering_actor }} committing development: ${{ github.run_number }}"
git push origin HEAD:development
set +x