rattler-build-action
is a GitHub Action for building conda packages using rattler-build.
Create .github/workflows/package.yml
in your repository. Here's a quick template:
name: Package
on: [push]
jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build conda package
uses: prefix-dev/[email protected]
Warning
Since rattler-build is still experimental and the API can change in minor versions, please pin this action to its minor version, i.e., prefix-dev/[email protected]
.
Tip
You can use dependabot to automatically update the version of rattler-build-action
. Add the following to your .github/dependabot.yml
:
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
gh-actions:
patterns:
- "*"
This action will build the conda recipe in conda.recipe/recipe.yaml
and upload the built packages as a build artifact.
rattler-build-version
: Define the version of rattler-build. Pins to the latest version that is available when releasing.recipe-path
: Path to the rattler recipe. Defaults toconda.recipe/recipe.yaml
.upload-artifact
: Decide whether to upload the built packages as a build artifact.build-args
: Additional arguments to pass torattler-build build
.artifact-name
: Name of the artifact that is uploaded after build. If runningrattler-build-action
multiple times in a matrix, you need a distinct name for each workflow.
rattler-build-version
is strictly pinned to the latest version of rattler-build
that is available when releasing a new version of rattler-build-action
.
This is to ensure that no breakages occur if a new version of rattler-build
is released.
You can use dependabot to automatically update the version of prefix-dev/rattler-build-action
which will also update the version of rattler-build
to the latest version.
jobs:
build:
name: Build package
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target-platform: linux-64
- os: ubuntu-latest
target-platform: linux-aarch64
- os: windows-latest
target-platform: win-64
- os: macos-latest
target-platform: osx-64
- os: macos-14
target-platform: osx-arm64
steps:
- uses: actions/checkout@v4
- name: Build conda package
uses: prefix-dev/[email protected]
with:
# needs to be unique for each matrix entry
artifact-name: package-${{ matrix.target-platform }}
build-args: --target-platform ${{ matrix.target-platform }}${{ matrix.target-platform == 'linux-aarch64' && ' --no-test' || '' }}
jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build conda package
uses: prefix-dev/[email protected]
- run: |
for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \) ); do
echo "Uploading ${pkg}"
rattler-build upload quetz "${pkg}"
done
env:
QUETZ_SERVER_URL: https://my.quetz.server
QUETZ_API_KEY: ${{ secrets.QUETZ_API_KEY }}
QUETZ_CHANNEL: my-channel
jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build conda package
uses: prefix-dev/[email protected]
- run: |
for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \) ); do
echo "Uploading ${pkg}"
rattler-build upload prefix -c my-channel "${pkg}"
done
env:
PREFIX_API_KEY: ${{ secrets.PREFIX_API_KEY }}
You can use a private channel while building your conda package by setting the RATTLER_AUTH_FILE
environment variable.
As of now, rattler-build
does not support a login
command prefix-dev/rattler-build#334, so you need to create the RATTLER_AUTH_FILE
manually.
jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Authenticate with private channel
run: |
RATTLER_AUTH_FILE=${{ runner.temp }}/credentials.json
echo '{"my.quetz.server": {"CondaToken": "${{ secrets.QUETZ_API_KEY }}"}}' > "$RATTLER_AUTH_FILE"
echo "RATTLER_AUTH_FILE=$RATTLER_AUTH_FILE" >> "$GITHUB_ENV"
- name: Build conda package
uses: prefix-dev/[email protected]
with:
build-args: -c conda-forge -c https://my.quetz.server/get/my-channel