Skip to content

Commit 1d9fc6f

Browse files
try to handle correctly multi-outputs recipes for packages deletion
1 parent 9b34109 commit 1d9fc6f

3 files changed

Lines changed: 31 additions & 5 deletions

File tree

.github/workflows/build_publish_package.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ on:
2424
publish-package:
2525
required: true
2626
type: boolean
27+
output-packages:
28+
required: false
29+
type: string
2730
git-sha:
2831
required: false
2932
type: string
@@ -89,6 +92,15 @@ jobs:
8992
echo "PKG_DIR=$CONDA_PREFIX/rattler-bld" >> $GITHUB_ENV
9093
fi
9194
95+
- name: Setup output packages
96+
shell: bash -l {0}
97+
run: |
98+
if [ -z "${{ inputs.output-packages }}" ]; then
99+
echo "OUTPUT_PKGS=[\'${{ inputs.package-name }}\']" >> $GITHUB_ENV
100+
else
101+
echo "OUTPUT_PKGS=${{ inputs.output-packages }}" >> $GITHUB_ENV
102+
fi
103+
92104
- name: Show conda config
93105
shell: bash -l {0}
94106
run: |
@@ -143,8 +155,10 @@ jobs:
143155
shell: bash -l {0}
144156
run: |
145157
cd ${{ env.PKG_DIR }}/${{ inputs.platform }}
146-
for file in *${{ inputs.package-name }}*.conda; do
147-
curl -X DELETE https://prefix.dev/api/v1/delete/${{ inputs.channel }}/${{ inputs.platform }}/$file -H "Authorization: Bearer ${{ secrets.api-key }}"
158+
for PKG_FILE in $(echo "${{ env.OUTPUT_PKGS }}" | tr -d '[]' | tr ',' '\n' | xargs); do
159+
for file in *$PKG_FILE*.conda; do
160+
curl -X DELETE https://prefix.dev/api/v1/delete/${{ inputs.channel }}/${{ inputs.platform }}/$file -H "Authorization: Bearer ${{ secrets.api-key }}"
161+
done
148162
done
149163
150164
# For devel packages, we only keep last build. So we will remove previous one(s) after successful publish
@@ -153,14 +167,24 @@ jobs:
153167
id: query_filenames
154168
shell: bash -l {0}
155169
run: |
156-
echo "result=$(python .github/workflows/fetch_packages_names.py --channel ${{ inputs.channel }} --package ${{ inputs.package-name }} --platform ${{ inputs.platform }})" >> $GITHUB_OUTPUT
170+
result='[]'
171+
for PKG_FILE in $(echo "${{ env.OUTPUT_PKGS }}" | tr -d '[]' | tr ',' '\n' | xargs); do
172+
new=$(python fetch_packages_names.py --channel ${{ inputs.channel }} --package $PKG_FILE --platform ${{ inputs.platform }})
173+
result=$(
174+
jq -c --argjson nxt "$new" \
175+
'. + $nxt' <<< "$result"
176+
)
177+
done
178+
echo "$result >> $GITHUB_OUTPUT"
157179
158180
- name: Publish conda package
159181
if: ${{ inputs.publish-package == true }}
160182
shell: bash -l {0}
161183
run: |
162-
for file in ${{ env.PKG_DIR }}/**/*${{ inputs.package-name }}*.conda; do
163-
rattler-build upload prefix -c ${{ inputs.channel }} --api-key ${{ secrets.api-key }} "$file"
184+
for PKG_FILE in $(echo "${{ env.OUTPUT_PKGS }}" | tr -d '[]' | tr ',' '\n' | xargs); do
185+
for file in ${{ env.PKG_DIR }}/**/*$PKG_FILE*.conda; do
186+
rattler-build upload prefix -c ${{ inputs.channel }} --api-key ${{ secrets.api-key }} "$file"
187+
done
164188
done
165189
166190
- name: Remove existing package [devel]

.github/workflows/devel-sofa.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
recipe-dir: devel
9696
# only publish packages on pull request merging OR when called manually through workflow_dispatch OR workflow call OR repository_dispatch
9797
publish-package: ${{ (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' || github.event_name == 'repository_dispatch' }}
98+
output-packages: ["libsofa", "sofa-devel", "sofa-gl"]
9899
git-sha: ${{ needs.extract-params.outputs.git-sha }}
99100
git-commit-date: ${{ needs.extract-params.outputs.git-commit-date }}
100101
secrets:

.github/workflows/sofa.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
platform: ${{ matrix.target.platform }}
5050
channel: sofa-framework
5151
recipe-dir: release-v25.06
52+
output-packages: ["libsofa", "sofa-devel", "sofa-gl"]
5253
# only publish packages on pull request merging OR when called manually through workflow_dispatch OR workflow call
5354
publish-package: ${{ (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' }}
5455
secrets:

0 commit comments

Comments
 (0)