query conda package from prefix.dev hosted channel #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: query conda package from prefix.dev hosted channel | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| inputs: | |
| channel: | |
| description: 'Channel' | |
| required: true | |
| options: [sofa-framework, sofa-framework-devel] | |
| default: 'sofa-framework-devel' | |
| platform: | |
| description: 'Platform' | |
| required: true | |
| type: choice | |
| options: [linux-64, linux-aarch64, osx-64, osx-arm64, win-64] | |
| default: 'linux-64' | |
| package-name: | |
| description: 'Package name' | |
| required: true | |
| type: string | |
| default: 'libsofa' | |
| output-packages: | |
| required: false | |
| type: string | |
| jobs: | |
| remove-conda-package-from-prefix: | |
| name: "packages on ${{ inputs.runner }}" | |
| runs-on: ubuntu-slim | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install requests | |
| # - name: Query files | |
| # id: query_filenames | |
| # run: | | |
| # echo "result=$(python .github/workflows/fetch_packages_names.py --channel ${{ inputs.channel }} --package ${{ inputs.package }} --platform ${{ inputs.platform }})" >> $GITHUB_OUTPUT | |
| - name: Setup output packages | |
| shell: bash -l {0} | |
| run: | | |
| if [ -z "${{ inputs.output-packages }}" ]; then | |
| echo "OUTPUT_PKGS=[\'${{ inputs.package-name }}\']" >> $GITHUB_ENV | |
| else | |
| echo "OUTPUT_PKGS=${{ inputs.output-packages }}" >> $GITHUB_ENV | |
| fi | |
| - name: Query existing package(s) [devel] | |
| id: query_filenames | |
| shell: bash -l {0} | |
| run: | | |
| result='[]' | |
| for PKG_FILE in $(echo "${{ env.OUTPUT_PKGS }}" | tr -d '[]' | tr ',' '\n' | xargs); do | |
| new=$(python .github/workflows/fetch_packages_names.py --channel ${{ inputs.channel }} --package $PKG_FILE --platform ${{ inputs.platform }}) | |
| result=$( | |
| jq -c --argjson nxt "$new" \ | |
| '. + $nxt' <<< "$result" | |
| ) | |
| done | |
| echo "result=$result" >> $GITHUB_OUTPUT | |
| - name: Loop over results | |
| run: | | |
| packages='${{ steps.query_filenames.outputs.result }}' | |
| echo "$packages" | jq -c '.[]' | while read filename; do | |
| echo $filename | |
| done | |