> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Anaconda GitHub Actions

export const GCell = ({children, className}) => <div className={`grid-table-cell ${className || ""}`} role="cell">
    {children}
  </div>;

export const GTH = ({children, className}) => <div className={`grid-table-th ${className || ""}`} role="columnheader">
    {children}
  </div>;

export const GRow = ({children}) => <div className="grid-table-row" role="row">{children}</div>;

export const GBody = ({children}) => <div className="grid-table-body" role="rowgroup">{children}</div>;

export const GHead = ({children}) => <div className="grid-table-head" role="rowgroup">{children}</div>;

export const GTable = ({children, className, cols}) => <div className={`grid-table not-prose overflow-hidden rounded-2xl ${className || ""}`} style={{
  "--grid-table-cols": cols
}} role="table">
    {children}
  </div>;

Anaconda's official [GitHub Actions](https://github.com/anaconda/actions) allow you to integrate Anaconda tools and package management into your CI/CD workflows, replacing the need for manual CLI setup or uncertified community actions.

## setup-anaconda-cli

Provisions the [Anaconda CLI](/cli-reference/anaconda-cli/getting-started) and optional tools (like `pixi`) in your runner, so you can use them directly in subsequent workflow steps.

### Usage example

```yaml theme={null}
- uses: anaconda/actions/setup-anaconda-cli@v0
  with:
    tools: anaconda-cli, pixi
```

### Inputs

<GTable cols="20% 55% 25%">
  <GHead>
    <GRow>
      <GTH>Input</GTH>
      <GTH>Description</GTH>
      <GTH>Default</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`version`</GCell>
      <GCell>Version of `ana` to install (for example, `0.3.0` or `latest`)</GCell>
      <GCell>`latest`</GCell>
    </GRow>

    <GRow>
      <GCell>`tools`</GCell>
      <GCell>Space or comma-separated list of [available tools](/cli-reference/anaconda-cli/tools#available-tools) to install</GCell>
      <GCell>—</GCell>
    </GRow>
  </GBody>
</GTable>

### Outputs

<GTable cols="30% 70%">
  <GHead>
    <GRow>
      <GTH>Output</GTH>
      <GTH>Description</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`version`</GCell>
      <GCell>The version of `ana` that was installed</GCell>
    </GRow>
  </GBody>
</GTable>

### Platform support

This action supports Linux, macOS, and Windows runners.

## upload-package

Uploads conda or Python packages to any Anaconda registry. The `target-type` input determines where packages are published.

### Usage examples

<Tabs>
  <Tab title="Anaconda.org">
    Upload a conda package to your Anaconda.org organization:

    ```yaml theme={null}
    - uses: anaconda/actions/upload-package@v0
      with:
        token: ${{ secrets.ANACONDA_ORG_TOKEN }}
        channel: my-org
        packages: ./build/noarch/*.conda
    ```

    Upload a Python wheel as a private package with labels:

    ```yaml theme={null}
    - uses: anaconda/actions/upload-package@v0
      with:
        token: ${{ secrets.ANACONDA_ORG_TOKEN }}
        channel: my-org
        packages: ./dist/*.whl
        private: true
        labels: main,dev
    ```
  </Tab>

  <Tab title="Package Security Manager">
    Upload a conda package to Package Security Manager:

    ```yaml theme={null}
    - uses: anaconda/actions/upload-package@v0
      with:
        token: ${{ secrets.PSM_TOKEN }}
        channel: my-channel
        packages: ./build/noarch/*.conda
        target-type: psm
        repository-url: https://pkgs.example.com/api/repo
    ```

    <Note>Your GitHub Actions runner must have network access to your PSM instance.</Note>
  </Tab>
</Tabs>

### Authentication

The `upload-package` action requires an API token for the registry you're publishing to. Generate a token for your target registry, then store it as a [GitHub Actions secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions) in your repository or organization settings.

* **Anaconda.org**: [Generate a token](/anaconda-org/admin-guide/tokens) with the `api:write` scope.
* **Package Security Manager**: [Generate a token](/psm-on-prem/6.8.0/user/auth_token) with **Write** permissions for your target channel.

### Inputs

<GTable cols="22% 55% 23%">
  <GHead>
    <GRow>
      <GTH>Input</GTH>
      <GTH>Description</GTH>
      <GTH>Default</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`token`</GCell>
      <GCell><Badge shape="pill" stroke color="blue" size="xs">Required</Badge> API token for authentication</GCell>
      <GCell>—</GCell>
    </GRow>

    <GRow>
      <GCell>`packages`</GCell>
      <GCell><Badge shape="pill" stroke color="blue" size="xs">Required</Badge> Path or glob pattern to package files (for example, `./build/noarch/*.conda`)</GCell>
      <GCell>—</GCell>
    </GRow>

    <GRow>
      <GCell>`channel`</GCell>
      <GCell><Badge shape="pill" stroke color="blue" size="xs">Required</Badge> Channel to publish your package to <br />
      <Tip>For Anaconda.org, this is your username or organization name.</Tip></GCell>
      <GCell>—</GCell>
    </GRow>

    <GRow>
      <GCell>`target-type`</GCell>
      <GCell>`anaconda.org` or `psm`</GCell>
      <GCell>`anaconda.org`</GCell>
    </GRow>

    <GRow>
      <GCell>`repository-url`</GCell>
      <GCell>Repository URL (required for `psm` target)</GCell>
      <GCell>—</GCell>
    </GRow>

    <GRow>
      <GCell>`package-type`</GCell>
      <GCell>`conda` or `pypi` (auto-detected from file extension if omitted)</GCell>
      <GCell>—</GCell>
    </GRow>

    <GRow>
      <GCell>`force`</GCell>
      <GCell>Overwrite existing packages</GCell>
      <GCell>`false`</GCell>
    </GRow>

    <GRow>
      <GCell>`verbose`</GCell>
      <GCell>Enable verbose output</GCell>
      <GCell>`false`</GCell>
    </GRow>
  </GBody>
</GTable>

The following inputs apply only when `target-type` is `anaconda.org`:

<GTable cols="20% 55% 25%">
  <GHead>
    <GRow>
      <GTH>Input</GTH>
      <GTH>Description</GTH>
      <GTH>Default</GTH>
    </GRow>
  </GHead>

  <GBody>
    <GRow>
      <GCell>`summary`</GCell>
      <GCell>Package summary</GCell>
      <GCell>—</GCell>
    </GRow>

    <GRow>
      <GCell>`private`</GCell>
      <GCell>Make the package private</GCell>
      <GCell>`false`</GCell>
    </GRow>

    <GRow>
      <GCell>`labels`</GCell>
      <GCell>Comma-separated labels (for example, `main,dev`)</GCell>
      <GCell>—</GCell>
    </GRow>
  </GBody>
</GTable>

## Full workflow example

This workflow builds a conda package on push to a version tag and publishes it to Anaconda.org:

```yaml expandable theme={null}
name: Build and publish

on:
  push:
    tags:
      - 'v*'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup miniconda
        uses: conda-incubator/setup-miniconda@v3
        with:
          channels: defaults

      - name: Build conda package
        shell: bash -el {0}
        run: |
          conda install -y conda-build
          conda build recipe --output-folder ./build

      - name: Upload build artifact
        uses: actions/upload-artifact@v4
        with:
          name: conda-package
          path: ./build/noarch/*.conda

  publish:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Download artifact
        uses: actions/download-artifact@v4
        with:
          name: conda-package
          path: ./dist

      - name: Publish to Anaconda.org
        uses: anaconda/actions/upload-package@v0
        with:
          token: ${{ secrets.ANACONDA_ORG_TOKEN }}
          channel: my-org
          packages: ./dist/*.conda
```

## Migrating from existing workflows

If you're currently using CLI commands directly in your workflows, you can replace them with the `upload-package` action:

<Tabs>
  <Tab title="Anaconda.org">
    **Before:**

    ```yaml theme={null}
    - name: Install anaconda-client
      run: conda install -y anaconda-client
    - name: Upload
      run: |
        anaconda --token ${{ secrets.TOKEN }} upload \
          --user my-org \
          --private \
          ./build/*.conda
    ```

    **After:**

    ```yaml theme={null}
    - uses: anaconda/actions/upload-package@v0
      with:
        token: ${{ secrets.TOKEN }}
        channel: my-org
        packages: ./build/*.conda
        private: true
    ```
  </Tab>

  <Tab title="Package Security Manager">
    **Before:**

    ```yaml theme={null}
    - name: Install conda-repo-cli
      run: conda install -y conda-repo-cli
    - name: Upload
      run: |
        conda repo config --set sites.mysite.url https://pkgs.example.com/api/repo
        conda repo --token ${{ secrets.TOKEN }} --site mysite upload \
          --channel my-channel \
          --package-type conda \
          ./build/*.conda
    ```

    **After:**

    ```yaml theme={null}
    - uses: anaconda/actions/upload-package@v0
      with:
        token: ${{ secrets.TOKEN }}
        channel: my-channel
        packages: ./build/*.conda
        target-type: psm
        repository-url: https://pkgs.example.com/api/repo
    ```
  </Tab>
</Tabs>

## Release history

For a complete list of versions and changes, see the [GitHub Actions releases](https://github.com/anaconda/actions/releases).
