|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + required: true |
| 8 | + default: 'x.y.z' |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + pull-requests: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + |
| 16 | + release: |
| 17 | + name: make github release |
| 18 | + runs-on: ubuntu-24.04 |
| 19 | + steps: |
| 20 | + |
| 21 | + - name: create release |
| 22 | + uses: softprops/action-gh-release |
| 23 | + with: |
| 24 | + name: v${{ github.event.inputs.version }} |
| 25 | + generate_release_notes: true |
| 26 | + tag_name: ${{ github.event.inputs.version }} |
| 27 | + |
| 28 | + conda: |
| 29 | + name: publish conda to anaconda.org |
| 30 | + needs: release |
| 31 | + runs-on: ubuntu-24.04 |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + with: |
| 37 | + ref: main |
| 38 | + |
| 39 | + - name: Set version in conda recipe |
| 40 | + run: | |
| 41 | + sed -i "s/^{% set version = \".*\" %}$/{% set version = \"${{ github.event.inputs.version }}\" %}/" conda-recipe/meta.yaml |
| 42 | + grep '{% set version' conda-recipe/meta.yaml |
| 43 | +
|
| 44 | + - name: Setup Conda (conda-forge only) |
| 45 | + uses: conda-incubator/setup-miniconda@v3 |
| 46 | + with: |
| 47 | + miniforge-variant: Miniforge3 |
| 48 | + python-version: "3.13.2" |
| 49 | + auto-activate: false |
| 50 | + conda-remove-defaults: true |
| 51 | + channels: conda-forge salilab |
| 52 | + channel-priority: strict |
| 53 | + |
| 54 | + - name: Install build tools |
| 55 | + shell: bash -l {0} |
| 56 | + run: | |
| 57 | + conda install -y conda-build anaconda-client |
| 58 | + conda config --set anaconda_upload no |
| 59 | +
|
| 60 | + - name: Build package |
| 61 | + shell: bash -l {0} |
| 62 | + env: |
| 63 | + PIP_NO_INDEX: "0" |
| 64 | + run: | |
| 65 | + PKG_PATH=$(conda build conda-recipe --output) |
| 66 | + echo "PKG_PATH=$PKG_PATH" >> "$GITHUB_ENV" |
| 67 | + conda build conda-recipe |
| 68 | + test -f "$PKG_PATH" |
| 69 | + echo "Built: $PKG_PATH" |
| 70 | +
|
| 71 | + - name: Upload to Anaconda |
| 72 | + shell: bash -l {0} |
| 73 | + env: |
| 74 | + ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} |
| 75 | + run: | |
| 76 | + anaconda -t "$ANACONDA_API_TOKEN" upload "$PKG_PATH" --user CCPBioSim --forc |
0 commit comments