Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ replace = "Version: {new_version}"

[[tool.bumpversion.files]]
filename = ".github/workflows/deploy.yaml"
search = "VERSION: '{current_version}'"
replace = "VERSION: '{new_version}'"
search = "pkg_version: '{current_version}' # bump"
replace = "pkg_version: '{new_version}' # bump"

[[tool.bumpversion.files]]
filename = "deploy/conda/recipe/recipe.yaml"
Expand Down
153 changes: 15 additions & 138 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,145 +5,22 @@ on:
branches:
- main
- dev
env:
pkg_name: nemo
anaconda_token: ${{ secrets.ANACONDA_UPLOAD_TOKEN }}
conda_recipe: deploy/conda/recipe
conda_env_yaml: deploy/conda/env/yaml
conda_env_lock: deploy/conda/env/lock
conda_org: tidywf
VERSION: '0.0.3.9006' # bump

jobs:
conda:
condarise_and_tag:
if: "startsWith(github.event.head_commit.message, 'Bump version:')"
name: Conda Deployment
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
permissions:
contents: write # for lockfiles
name: Condarise and Tag
uses: tidywf/.github/.github/workflows/condarise-and-tag.yaml@main
with:
pkg_name: nemo
pkg_version: '0.0.3.9006' # bump
secrets: inherit

steps:
- name: 🤖 Generate app token
uses: actions/create-github-app-token@v3
id: app-token1
with:
app_id: ${{ vars.BOT1_APP_ID }}
private_key: ${{ secrets.BOT1_APP_PRIVATE_KEY }}
- name: 🚚 Code checkout
uses: actions/checkout@v6
with:
token: ${{ steps.app-token1.outputs.token }} # branch write override
persist-credentials: false
- name: 👾 Miniforge setup
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
environment-file: ${{ env.conda_env_yaml }}/condabuild.yaml
activate-environment: condabuild_env
miniforge-version: latest
- name: 🐍 Conda pkg build
run: |
EXTRA_CHANNEL=""
[[ "${{ github.ref }}" == "refs/heads/dev" ]] && EXTRA_CHANNEL="--channel ${{ env.conda_org }}/label/dev"
rattler-build build \
${EXTRA_CHANNEL} \
--channel ${{ env.conda_org }} \
--channel conda-forge \
--recipe ${{ env.conda_recipe }}/recipe.yaml \
--output-dir ${RUNNER_TEMP}/out1
- name: 🐍 Conda pkg upload
run: |
pkg_path=$(find ${RUNNER_TEMP}/out1 -type f -name "*.conda")
LABEL_ARG=""
[[ "${{ github.ref }}" == "refs/heads/dev" ]] && LABEL_ARG="--channel dev"
rattler-build upload anaconda \
--owner ${{ env.conda_org }} \
--api-key ${{ env.anaconda_token }} \
${LABEL_ARG} \
${pkg_path}
- name: 🔒 Conda lock
run: |
CHANNEL_ARGS="--channel ${{ env.conda_org }} --channel conda-forge"
[[ "${{ github.ref }}" == "refs/heads/dev" ]] && CHANNEL_ARGS="--channel ${{ env.conda_org }}/label/dev ${CHANNEL_ARGS}"
conda-lock lock \
--file ${{ env.conda_env_yaml }}/${{ env.pkg_name }}.yaml \
${CHANNEL_ARGS} \
-p linux-64
conda-lock render \
-p linux-64 \
conda-lock.yml \
&& rm conda-lock.yml \
&& mv conda-linux-64.lock ${{ env.conda_env_lock }}/
- name: 💾 Commit lockfiles
env:
APP_ID: ${{ vars.BOT1_APP_ID }}
run: |
git status
git config --local user.email "${APP_ID}+tidywf-ci-bot[bot]@users.noreply.github.com"
git config --local user.name "tidywf-ci-bot[bot]"
MSG="[bot] Updating conda-lock files (v${{ env.VERSION }})"
git add .
git commit -m "${MSG}"
git push
- name: 📥 Pull lock commit
id: pull_lock_commit
run: |
git pull --no-rebase
git --no-pager log --decorate=short --pretty=oneline -n3
LATEST_COMMIT_HASH="$(git --no-pager log -1 --format='%H')"
echo "latest_commit_hash=${LATEST_COMMIT_HASH}" >> $GITHUB_OUTPUT
- name: 🔖 Create tag
uses: actions/github-script@v8
env:
LATEST_COMMIT_HASH: ${{ steps.pull_lock_commit.outputs.latest_commit_hash }}
with:
script: |
const the_tag_name = 'refs/tags/v' + process.env.VERSION
const the_sha = process.env.LATEST_COMMIT_HASH
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: the_tag_name,
sha: the_sha
})

pkgdown:
name: pkgdown
needs: [conda]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
permissions:
contents: write # for committing
steps:
- name: 🤖 Generate app token
uses: actions/create-github-app-token@v3
id: app-token2
with:
app_id: ${{ vars.BOT1_APP_ID }}
private_key: ${{ secrets.BOT1_APP_PRIVATE_KEY }}
- name: 🚚 Code checkout
uses: actions/checkout@v6
with:
ref: v${{ env.VERSION }}
token: ${{ steps.app-token2.outputs.token }} # branch write override
persist-credentials: false
- name: 👾 Miniforge setup
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
environment-file: ${{ env.conda_env_yaml }}/pkgdown.yaml
activate-environment: pkgdown_env
miniforge-version: latest
- name: 🌐 Website publish
env:
APP_ID: ${{ vars.BOT1_APP_ID }}
run: |
Rscript -e "list.files(system.file('extdata', package = 'nemo'), recursive = TRUE)"
git config --local user.email "${APP_ID}+tidywf-ci-bot[bot]@users.noreply.github.com"
git config --local user.name "tidywf-ci-bot[bot]"
Rscript -e "pkgdown::deploy_to_branch(pkg = '.', new_process = FALSE)"
pkgdownise:
name: Pkgdownise
needs: [condarise_and_tag]
uses: tidywf/.github/.github/workflows/pkgdownise.yaml@main
with:
pkg_name: nemo
pkg_version: '0.0.3.9006' # bump
secrets: inherit
28 changes: 10 additions & 18 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,31 +131,23 @@ Use `make bump VERSION=x.y.z` to bump the version. This runs `bump-my-version` (

## CI/CD: `.github/workflows/deploy.yaml`

The `conda-docs` workflow triggers on pushes to `main` or `dev`, but only runs when the commit message starts with `Bump version:`.
The `conda-docs` workflow triggers on pushes to `main` or `dev`, but only runs when the commit message starts with `Bump version:`. Both jobs call reusable workflows from `tidywf/.github`.

### Jobs

**`conda`** — builds and uploads the conda package:
1. Builds the package with `rattler-build` using the recipe at `deploy/conda/recipe/recipe.yaml`
2. Uploads to Anaconda under the `tidywf` owner; uses `--channel dev` label when on the `dev` branch
**`condarise_and_tag`** — delegates to `tidywf/.github/.github/workflows/condarise-and-tag.yaml`:
1. Builds the conda package with `rattler-build`
2. Uploads to Anaconda under the `tidywf` owner; uses `--channel dev` label on `dev`
3. Regenerates the conda lock file (`deploy/conda/env/lock/conda-linux-64.lock`) for `linux-64`
4. Commits and pushes the updated lock file as a bot commit (`[bot] Updating conda-lock files (v<VERSION>)`)
5. Creates a git tag (`vVERSION`) — only on `main`
4. Commits and pushes the updated lock file as a bot commit
5. Creates a git tag (`vVERSION`) — on both branches

**`pkgdown`** (depends on `conda`) — publishes the documentation site:
- On `main`: checks out the tagged release commit, then deploys via `pkgdown::deploy_to_branch()`
- On `dev`: checks out the branch tip and deploys
**`pkgdownise`** (depends on `condarise_and_tag`) — delegates to `tidywf/.github/.github/workflows/pkgdownise.yaml`:
- Checks out the release tag, then deploys via `pkgdown::deploy_to_branch()` — same flow on both branches

### Key variables
### Version

| Variable | Value |
|----------|-------|
| `VERSION` | Set manually in the workflow file (line 14) when bumping the package version |
| `conda_recipe` | `deploy/conda/recipe` |
| `conda_env_yaml` | `deploy/conda/env/yaml` |
| `conda_env_lock` | `deploy/conda/env/lock` |

> When releasing, update `VERSION` in `deploy.yaml` to match the new package version before committing the version bump.
The version is set via `pkg_version:` in the `with:` blocks of each job. `make bump VERSION=x.y.z` updates all occurrences automatically.

## Output Formats

Expand Down
Loading