-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
127 lines (109 loc) · 3.58 KB
/
action.yml
File metadata and controls
127 lines (109 loc) · 3.58 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
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
name: 'Localization Resource Manager'
description: 'Manage, validate, and analyze .NET .resx localization files'
author: 'Nikolaos Protopapas'
branding:
icon: 'globe'
color: 'blue'
inputs:
command:
description: 'LRM command to run (validate, stats, view, export, etc.)'
required: true
path:
description: 'Path to resource files directory'
required: false
default: '.'
args:
description: 'Additional arguments to pass to LRM'
required: false
default: ''
version:
description: 'LRM version to use (default: latest)'
required: false
default: 'latest'
outputs:
exit-code:
description: 'Exit code from LRM command'
value: ${{ steps.run-lrm.outputs.exit-code }}
output:
description: 'Command output'
value: ${{ steps.run-lrm.outputs.output }}
runs:
using: 'composite'
steps:
- name: Download LRM
id: download
shell: bash
run: |
set -e
# Determine platform
if [[ "$RUNNER_OS" == "Linux" ]]; then
if [[ "$RUNNER_ARCH" == "X64" ]]; then
PLATFORM="linux-x64"
elif [[ "$RUNNER_ARCH" == "ARM64" ]]; then
PLATFORM="linux-arm64"
else
echo "Unsupported Linux architecture: $RUNNER_ARCH"
exit 1
fi
elif [[ "$RUNNER_OS" == "Windows" ]]; then
if [[ "$RUNNER_ARCH" == "X64" ]]; then
PLATFORM="win-x64"
elif [[ "$RUNNER_ARCH" == "ARM64" ]]; then
PLATFORM="win-arm64"
else
echo "Unsupported Windows architecture: $RUNNER_ARCH"
exit 1
fi
else
echo "Unsupported OS: $RUNNER_OS"
exit 1
fi
echo "Platform: $PLATFORM"
# Determine download URL based on version
if [[ "${{ inputs.version }}" == "latest" ]]; then
# Use /latest/download for static filenames
BASE_URL="https://github.com/nickprotop/LocalizationManager/releases/latest/download"
else
# Use specific version tag
BASE_URL="https://github.com/nickprotop/LocalizationManager/releases/download/v${{ inputs.version }}"
fi
# Download URL (static filenames without version)
if [[ "$RUNNER_OS" == "Windows" ]]; then
FILENAME="lrm-${PLATFORM}.zip"
URL="${BASE_URL}/${FILENAME}"
echo "Downloading from: $URL"
curl -L -o lrm.zip "$URL"
unzip -q lrm.zip -d lrm-bin
chmod +x lrm-bin/${PLATFORM}/lrm.exe
echo "lrm_path=$(pwd)/lrm-bin/${PLATFORM}/lrm.exe" >> $GITHUB_OUTPUT
else
FILENAME="lrm-${PLATFORM}.tar.gz"
URL="${BASE_URL}/${FILENAME}"
echo "Downloading from: $URL"
curl -L -o lrm.tar.gz "$URL"
tar -xzf lrm.tar.gz
chmod +x ${PLATFORM}/lrm
echo "lrm_path=$(pwd)/${PLATFORM}/lrm" >> $GITHUB_OUTPUT
fi
echo "LRM downloaded successfully"
- name: Run LRM
id: run-lrm
shell: bash
run: |
set +e # Don't exit on error, capture exit code
LRM_PATH="${{ steps.download.outputs.lrm_path }}"
# Run command and capture output
OUTPUT=$("$LRM_PATH" ${{ inputs.command }} --path "${{ inputs.path }}" ${{ inputs.args }} 2>&1)
EXIT_CODE=$?
# Save outputs
echo "exit-code=$EXIT_CODE" >> $GITHUB_OUTPUT
# Save output (handle multiline)
{
echo 'output<<EOF'
echo "$OUTPUT"
echo 'EOF'
} >> $GITHUB_OUTPUT
# Print output
echo "$OUTPUT"
# Exit with original code
exit $EXIT_CODE