Skip to content

Commit 1be2b0f

Browse files
committed
fix: respect output-dir on partial build
1 parent 849551b commit 1be2b0f

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

action.yaml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ inputs:
1212
package_name:
1313
description: 'The name of the package to add and/or update.'
1414
required: false
15-
15+
1616
runs:
1717
using: "composite"
1818
steps:
@@ -22,35 +22,47 @@ runs:
2222
run: |
2323
mkdir /tmp/.satis-build
2424
echo "{}" > /tmp/.satis-build/composer.json
25-
25+
# Install Satis
26+
echo "Installing Satis with Composer"
2627
composer g require composer/satis:dev-main --prefer-dist \
2728
--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 \
3235
--name="${{ github.repository }}" \
3336
--homepage="https://github.com/${{ github.repository_owner }}"
3437
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"
3749
php $COMPOSER_HOME/vendor/bin/satis add -n --name=${{ inputs.package_name }} \
3850
"https://github.com/${{ inputs.package_name }}" \
3951
${{ 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 }}
4153
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
4356
fi
44-
57+
# Archive packages if configured to do so
4558
if cat ${{ inputs.satis_config }} | jq .archive -e; then
59+
echo "Purging archived packages"
4660
php $COMPOSER_HOME/vendor/bin/satis purge ${{ inputs.satis_config }} -n
4761
fi
48-
4962
shell: bash
5063
- run: |
5164
rm -rf $COMPOSER_HOME
5265
shell: bash
53-
5466
branding:
5567
icon: 'download-cloud'
56-
color: 'gray-dark'
68+
color: 'gray-dark'

0 commit comments

Comments
 (0)