@@ -12,7 +12,7 @@ inputs:
12
12
package_name :
13
13
description : ' The name of the package to add and/or update.'
14
14
required : false
15
-
15
+
16
16
runs :
17
17
using : " composite"
18
18
steps :
@@ -22,35 +22,47 @@ runs:
22
22
run : |
23
23
mkdir /tmp/.satis-build
24
24
echo "{}" > /tmp/.satis-build/composer.json
25
-
25
+ # Install Satis
26
+ echo "Installing Satis with Composer"
26
27
composer g require composer/satis:dev-main --prefer-dist \
27
28
--no-cache --no-progress --no-interaction -o \
28
- --ignore-platform-reqs
29
-
30
- if ! [ -f "${{ inputs.satis_config }}" ]; then
31
- php $COMPOSER_HOME/vendor/bin/satis init ${{ inputs.satis_config }} -n \
29
+ --ignore-platform-reqs -q
30
+ echo "Satis installed."
31
+ # Initialse Satis if required
32
+ if [ ! -f "${{ inputs.satis_config }}" ]; then
33
+ echo "No existing Satis configuration found. Initializing..."
34
+ php $COMPOSER_HOME/vendor/bin/satis init ${{ inputs.satis_config }} -n -v \
32
35
--name="${{ github.repository }}" \
33
36
--homepage="https://github.com/${{ github.repository_owner }}"
34
37
fi
35
-
36
- if [ -n "${{ inputs.package_name }}"]; then
38
+ # Determine output directory
39
+ echo "Getting output directory"
40
+ OUTPUT_DIR=$(cat "${{ inputs.satis_config }}" | jq -rc '."output-dir"')
41
+ if [[ $OUTPUT_DIR == "null" ]]; then
42
+ echo "Output directory not set, using current directory."
43
+ OUTPUT_DIR="."
44
+ fi
45
+
46
+ # Determine build strategy
47
+ if [ ! -z "${{ inputs.package_name }}" ]; then
48
+ echo "Package provided... running partial build"
37
49
php $COMPOSER_HOME/vendor/bin/satis add -n --name=${{ inputs.package_name }} \
38
50
"https://github.com/${{ inputs.package_name }}" \
39
51
${{ inputs.satis_config }} || true
40
- php $COMPOSER_HOME/vendor/bin/satis build -n ${{ inputs.satis_config }} . ${{ inputs.package_name }}
52
+ php $COMPOSER_HOME/vendor/bin/satis build -n ${{ inputs.satis_config }} $OUTPUT_DIR ${{ inputs.package_name }}
41
53
else
42
- php $COMPOSER_HOME/vendor/bin/satis build -n ${{ inputs.satis_config }}
54
+ echo "Running full build"
55
+ php $COMPOSER_HOME/vendor/bin/satis build -n ${{ inputs.satis_config }} $OUTPUT_DIR
43
56
fi
44
-
57
+ # Archive packages if configured to do so
45
58
if cat ${{ inputs.satis_config }} | jq .archive -e; then
59
+ echo "Purging archived packages"
46
60
php $COMPOSER_HOME/vendor/bin/satis purge ${{ inputs.satis_config }} -n
47
61
fi
48
-
49
62
shell : bash
50
63
- run : |
51
64
rm -rf $COMPOSER_HOME
52
65
shell: bash
53
-
54
66
branding :
55
67
icon : ' download-cloud'
56
- color : ' gray-dark'
68
+ color : ' gray-dark'
0 commit comments