Merge pull request #107 from umccr/patch1 #135
This file contains 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: conda-docker-docs | |
on: | |
push: | |
branches: | |
- main | |
env: | |
atoken: ${{ secrets.ANACONDA_UPLOAD_TOKEN }} | |
recipe_path: conda/recipe | |
env_yaml_path: conda/env/yaml | |
env_lock_path: conda/env/lock | |
VERSION: '0.12.0' # versioned by bump2version | |
GDRIVE_CREDENTIALS_DATA: ${{ secrets.GDRIVE_CREDENTIALS_DATA }} | |
jobs: | |
condarise-dockerise-document: | |
# When merging to main and the commit message starts with 'Bump version:' | |
if: "startsWith(github.event.head_commit.message, 'Bump version:')" | |
name: Conda Docker Docs | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Code checkout | |
uses: actions/checkout@v4 | |
- name: Micromamba setup | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: ${{ env.env_yaml_path }}/condabuild.yaml | |
- name: π Conda pkg build and upload | |
run: | | |
dvc pull | |
ls -l inst/extdata/* | |
conda mambabuild --R 4.2 ${recipe_path} -c conda-forge --token ${atoken} | |
- name: π Conda lock | |
run: | | |
conda-lock lock --file ${env_yaml_path}/dracarys.yaml -p linux-64 | |
conda-lock render --kind explicit -p linux-64 conda-lock.yml --filename-template 'dracarys-{platform}.lock' && rm conda-lock.yml | |
mv dracarys-*.lock ${env_lock_path}/ | |
- name: πΎ Commit lockfile | |
run: | | |
git status | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
MSG="[bot] Updating conda-lock file (v${VERSION})" | |
git add . | |
git commit -m "${MSG}" | |
git push | |
- name: π Website publish | |
run: | | |
micromamba env create -n pkgdownenv -f ${env_yaml_path}/pkgdown.yaml | |
micromamba activate pkgdownenv | |
dracarys.R --version | |
Rscript -e "pkgdown::deploy_to_branch(pkg = '.', commit_message = paste(pkgdown:::construct_commit_message('.'), '- see https://umccr.github.io/dracarys/'), branch = 'gh-pages', new_process = FALSE)" | |
- 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@v7 | |
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 | |
}) | |
# work with tag from above | |
- name: Code checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: v${{ env.VERSION }} | |
- name: π° QEMU setup | |
uses: docker/setup-qemu-action@v3 | |
- name: π― Buildx setup | |
uses: docker/setup-buildx-action@v3 | |
with: | |
install: true | |
config-inline: | | |
[worker.oci] | |
max-parallelism = 2 | |
- name: π GitHub CR login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: π³ Docker img build and push | |
uses: docker/build-push-action@v5 | |
with: | |
tags: ghcr.io/${{ github.repository }}:${{ env.VERSION }} | |
context: . # yes, dot | |
push: true | |
platforms: linux/amd64 |