Build conda package #136
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: Build conda package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Version to package | |
| required: true | |
| default: 'latest' | |
| build: | |
| description: "Build revision of package (default: 0)" | |
| required: false | |
| default: '0' | |
| jobs: | |
| build_package_linux-64: | |
| name: Build conda package for linux-64 | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| variant: ["r43", "r44"] | |
| env: | |
| ANACONDA_API_KEY: ${{ secrets.ANACONDA_API_TOKEN }} | |
| ANACONDA_OWNER: ${{ vars.ANACONDA_OWNER }} | |
| steps: | |
| - name: Checkout pull request branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - id: latest-version | |
| name: Get latest version | |
| if: ${{ github.event.inputs.version }} == "latest" | |
| uses: pozetroninc/[email protected] | |
| with: | |
| repository: ${{ github.repository }} | |
| token: ${{ secrets.CI_TOKEN }} | |
| - name: Set version | |
| id: set-version | |
| run: | | |
| if [[ ${{ github.event.inputs.version }} != "latest" ]]; then | |
| version=${{ github.event.inputs.version }} | |
| else | |
| version=${{ steps.latest-version.outputs.release }} | |
| fi | |
| echo "version=${version}" >> "$GITHUB_OUTPUT" | |
| - name: Download release | |
| uses: robinraju/release-downloader@v1 | |
| with: | |
| tag: ${{ steps.set-version.outputs.version }} | |
| token: ${{ secrets.CI_TOKEN }} | |
| out-file-path: /tmp/recipe | |
| tarBall: true | |
| - name: Setup pixi | |
| uses: prefix-dev/[email protected] | |
| with: | |
| run-install: false | |
| - name: Create recipe from template | |
| shell: pixi exec --spec sed --spec coreutils --spec wget -- bash -e {0} | |
| run: | | |
| cp .github/recipe/recipe.yaml /tmp/recipe/recipe.yaml | |
| cp .github/recipe/variant_${{ matrix.variant}}.yaml /tmp/recipe/variants.yaml | |
| repository=${{ github.repository }} | |
| build=${{ github.event.inputs.build }} | |
| version=${{ steps.set-version.outputs.version }} | |
| sha256sum=$(sha256sum /tmp/recipe/${repository//*\//}-${version}.tar.gz | cut -d ' ' -f 1) | |
| sed -i "s/VERSION_PLACEHOLDER/${version}/g" /tmp/recipe/recipe.yaml | |
| sed -i "s/SHA256SUM_PLACEHOLDER/${sha256sum}/g" /tmp/recipe/recipe.yaml | |
| sed -i "s/BUILD_PLACEHOLDER/${build}/g" /tmp/recipe/recipe.yaml | |
| - name: Setup up docker buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and export docker containers | |
| uses: docker/build-push-action@v6 | |
| with: | |
| load: true | |
| file: .github/rattler-build_container.df | |
| tags: rattler-build:latest | |
| - name: Build conda packages | |
| run: | | |
| docker run --rm --volume /tmp:/tmp \ | |
| --volume /etc/passwd:/etc/passwd:ro \ | |
| --volume /etc/group:/etc/group:ro \ | |
| --volume $(pwd) --workdir $(pwd) \ | |
| --user $(id -u) rattler-build \ | |
| rattler-build build -c dnachun -c conda-forge -c bioconda \ | |
| --output-dir /tmp/rattler-build --recipe-dir /tmp/recipe | |
| - name: Upload package | |
| shell: pixi exec --spec rattler-build -- bash -e {0} | |
| run: rattler-build upload anaconda --force /tmp/rattler-build/linux-64/*.conda | |
| build_package_osx-arm64: | |
| name: Build conda package for osx-arm64 | |
| runs-on: macos-14 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| variant: ["r43", "r44"] | |
| env: | |
| ANACONDA_API_KEY: ${{ secrets.ANACONDA_API_TOKEN }} | |
| ANACONDA_OWNER: ${{ vars.ANACONDA_OWNER }} | |
| steps: | |
| - name: Checkout pull request branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get latest version | |
| id: latest-version | |
| if: ${{ github.event.inputs.version }} == "latest" | |
| uses: pozetroninc/[email protected] | |
| with: | |
| repository: ${{ github.repository }} | |
| token: ${{ secrets.CI_TOKEN }} | |
| - name: Set version | |
| id: set-version | |
| run: | | |
| if [[ ${{ github.event.inputs.version }} != "latest" ]]; then | |
| version=${{ github.event.inputs.version }} | |
| else | |
| version=${{ steps.latest-version.outputs.release }} | |
| fi | |
| echo "version=${version}" >> "$GITHUB_OUTPUT" | |
| - name: Download release | |
| uses: robinraju/release-downloader@v1 | |
| with: | |
| tag: ${{ steps.set-version.outputs.version }} | |
| token: ${{ secrets.CI_TOKEN }} | |
| out-file-path: /tmp/recipe | |
| tarBall: true | |
| - name: Setup pixi | |
| uses: prefix-dev/[email protected] | |
| with: | |
| run-install: false | |
| - name: Create recipe from template | |
| shell: pixi exec --spec sed --spec coreutils --spec wget -- bash -e {0} | |
| run: | | |
| cp .github/recipe/recipe.yaml /tmp/recipe/recipe.yaml | |
| cp .github/recipe/variant_${{ matrix.variant}}.yaml /tmp/recipe/variants.yaml | |
| repository=${{ github.repository }} | |
| build=${{ github.event.inputs.build }} | |
| version=${{ steps.set-version.outputs.version }} | |
| sha256sum=$(sha256sum /tmp/recipe/${repository//*\//}-${version}.tar.gz | cut -d ' ' -f 1) | |
| sed -i "s/VERSION_PLACEHOLDER/${version}/g" /tmp/recipe/recipe.yaml | |
| sed -i "s/SHA256SUM_PLACEHOLDER/${sha256sum}/g" /tmp/recipe/recipe.yaml | |
| sed -i "s/BUILD_PLACEHOLDER/${build}/g" /tmp/recipe/recipe.yaml | |
| - name: Build conda package | |
| shell: pixi exec --spec rattler-build -- bash -e {0} | |
| run: rattler-build build -c dnachun -c conda-forge -c bioconda --output-dir /tmp/rattler-build --recipe-dir /tmp/recipe | |
| - name: Upload package | |
| shell: pixi exec --spec rattler-build -- bash -e {0} | |
| run: rattler-build upload anaconda --force /tmp/rattler-build/osx-arm64/*.conda |