@@ -8,78 +8,85 @@ inputs:
88 config-file :
99 description : The path to the Dev Proxy configuration file
1010 required : false
11+ auto-stop :
12+ description : Automatically stop Dev Proxy when workflow completes
13+ required : false
14+ default : " true"
1115runs :
1216 using : composite
1317 steps :
14- - name : Start Dev Proxy
15- id : start
16- run : |
17- log_file="${{ inputs.log-file }}"
18+ - name : Start Dev Proxy with post step
19+ id : stat-with-post-step
20+ uses :
pyTooling/Actions/[email protected] 21+ with :
22+ main : |
23+ log_file="${{ inputs.log-file }}"
1824
19- echo "Starting Dev Proxy..."
25+ echo "Starting Dev Proxy..."
2026
21- # Create directory for Dev Proxy configuration and certificates
22- mkdir -p ~/.config/dev-proxy/rootCert
27+ # Create directory for Dev Proxy configuration and certificates
28+ mkdir -p ~/.config/dev-proxy/rootCert
2329
24- # Set environment variables for Dev Proxy
25- export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
26- export XDG_DATA_HOME=~/.config
27- export DEV_PROXY_CERT_PATH=rootCert/rootCert.pfx
30+ # Set environment variables for Dev Proxy
31+ export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
32+ export XDG_DATA_HOME=~/.config
33+ export DEV_PROXY_CERT_PATH=rootCert/rootCert.pfx
2834
29- echo "cert-path=$DEV_PROXY_CERT_PATH" >> $GITHUB_OUTPUT
35+ # Create cert-path
36+ cert_path="$XDG_DATA_HOME/dev-proxy/$DEV_PROXY_CERT_PATH"
3037
31- # start Dev Proxy in the background
32- # log Dev Proxy output to the log file
33- # log stdout and stderr to the file
34- config_arg=""
35- if [ -n "${{ inputs.config-file }}" ]; then
36- config_arg="-c ${{ inputs.config-file }}"
37- fi
38-
39- ./devproxy/devproxy $config_arg > $log_file 2>&1 &
38+ # start Dev Proxy in the background
39+ # log Dev Proxy output to the log file
40+ # log stdout and stderr to the file
41+ config_arg=""
42+ if [ -n "${{ inputs.config-file }}" ]; then
43+ config_arg="-c ${{ inputs.config-file }}"
44+ fi
4045
41- proxy_pid=$!
46+ ./devproxy/devproxy $config_arg > $log_file 2>&1 &
4247
43- # wait for init
44- echo "Waiting for Dev Proxy to start..."
45- while true; do
46- if grep -q "Configure your operating system to use this proxy's port and address 127.0.0.1:8000" $log_file; then
47- break
48- fi
49- sleep 1
50- done
51- shell : bash
52- - name : Trust certificate
53- id : trust-certificate
54- run : |
55- echo "🔒 Trusting Dev Proxy certificate..."
56-
57- # Use the cert-path from the start step output
58- cert_path="$HOME/.config/dev-proxy/${{ steps.start.outputs.cert-path }}"
48+ proxy_pid=$!
5949
60- echo "Checking for certificate at: $cert_path"
61- if [ -f "$cert_path" ]; then
62- echo "✅ Certificate found"
63-
64- echo "Exporting the Dev Proxy's Root Certificate"
65- if openssl pkcs12 -in "$cert_path" -clcerts -nokeys -out dev-proxy-ca.crt -passin pass:""; then
66- echo "Installing the Dev Proxy's Root Certificate"
67- sudo cp dev-proxy-ca.crt /usr/local/share/ca-certificates/
50+ # wait for init
51+ echo "Waiting for Dev Proxy to start..."
52+ while true; do
53+ if grep -q "Configure your operating system to use this proxy's port and address 127.0.0.1:8000" $log_file; then
54+ break
55+ fi
56+ sleep 1
57+ done
6858
69- echo "Updating the CA certificates"
70- sudo update-ca-certificates
59+ echo "🔒 Trusting Dev Proxy certificate..."
60+
61+ echo "Checking for certificate at: $cert_path"
62+ if [ -f "$cert_path" ]; then
63+ echo "✅ Certificate found"
7164
72- # Set the system proxy settings
73- echo "http_proxy=http://127.0.0.1:8000" >> $GITHUB_ENV
74- echo "https_proxy=http://127.0.0.1:8000" >> $GITHUB_ENV
75-
76- echo "✅ Dev Proxy certificate trusted successfully!"
65+ echo "Exporting the Dev Proxy's Root Certificate"
66+ if openssl pkcs12 -in "$cert_path" -clcerts -nokeys -out dev-proxy-ca.crt -passin pass:""; then
67+ echo "Installing the Dev Proxy's Root Certificate"
68+ sudo cp dev-proxy-ca.crt /usr/local/share/ca-certificates/
69+
70+ echo "Updating the CA certificates"
71+ sudo update-ca-certificates
72+
73+ # Set the system proxy settings
74+ echo "http_proxy=http://127.0.0.1:8000" >> $GITHUB_ENV
75+ echo "https_proxy=http://127.0.0.1:8000" >> $GITHUB_ENV
76+
77+ echo "✅ Dev Proxy certificate trusted successfully!"
78+ else
79+ echo "❌ Failed to export certificate from $cert_path"
80+ echo "⚠️ SSL verification may fail"
81+ fi
7782 else
78- echo "❌ Failed to export certificate from $cert_path"
79- echo "⚠️ SSL verification may fail"
83+ echo "❌ Certificate not found at: $cert_path"
84+ echo "⚠️ Skipping certificate trust - SSL verification may fail"
85+ fi
86+ post : |
87+ if [ "${{ inputs.auto-stop }}" = "true" ]; then
88+ echo "Stopping Dev Proxy..."
89+ curl -X POST http://127.0.0.1:8897/proxy/stopproxy
90+ echo "Dev Proxy has been stopped."
8091 fi
81- else
82- echo "❌ Certificate not found at: $cert_path"
83- echo "⚠️ Skipping certificate trust - SSL verification may fail"
84- fi
85- shell : bash
92+ shell : bash
0 commit comments