Skip to content

Bump version: 1.4.1.9020 → 1.4.1.9021 #305

Bump version: 1.4.1.9020 → 1.4.1.9021

Bump version: 1.4.1.9020 → 1.4.1.9021 #305

name: deploy
on:
push:
branches:
- master
- bundle_update_2023
- locale
env:
atoken: ${{ secrets.ANACONDA_UPLOAD_TOKEN }}
recipe_path: conda/recipe
env_yml_path: conda/env/yml
env_lock_path: conda/env/lock
VERSION: '1.4.1.9021' # versioned by bump2version
jobs:
build_pcgrr_conda_pkg:
# When merging to one of the branches above and the commit message matches
if: "startsWith(github.event.head_commit.message, 'Bump version:')"
name: Build pcgrr conda pkg
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_yml_path }}/condabuild.yml
- name: 🐍 Conda pkg build and upload
run: |
conda mambabuild ${recipe_path}/pcgrr -c conda-forge -c bioconda --token ${atoken}
build_pcgr_conda_pkg:
# When merging to one of the branches above and the commit message matches
if: "startsWith(github.event.head_commit.message, 'Bump version:')"
name: Build pcgr conda pkg
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_yml_path }}/condabuild.yml
- name: 🐍 Conda pkg build and upload
run: |
conda mambabuild ${recipe_path}/pcgr -c conda-forge -c bioconda --token ${atoken} --quiet
# spin up fresh instance since conda-lock takes ages when run on previous one
conda_lock:
name: Conda lock
runs-on: ubuntu-latest
needs: [build_pcgr_conda_pkg, build_pcgrr_conda_pkg]
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_yml_path }}/condabuild.yml
- name: 🔒 Conda lock
run: |
# 1. generate a combined lock file
# 2. render platform-specific locks
conda-lock lock --file ${env_yml_path}/pcgr.yml -p osx-64 -p linux-64
conda-lock render --kind explicit -p osx-64 -p linux-64 conda-lock.yml --filename-template 'pcgr-{platform}.lock' && rm conda-lock.yml
conda-lock lock --file ${env_yml_path}/pcgrr.yml -p osx-64 -p linux-64
conda-lock render --kind explicit -p osx-64 -p linux-64 conda-lock.yml --filename-template 'pcgrr-{platform}.lock' && rm conda-lock.yml
mv pcgrr-*.lock ${env_lock_path}
mv pcgr-*.lock ${env_lock_path}
- name: Commit changes
run: |
git status
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
MSG="[bot] Updating conda-lock files (v${VERSION})"
git add .
git commit -m "${MSG}"
git push
- name: 🌐 Website publish
if: github.ref_name == 'master'
run: |
micromamba env create -n pkgdownenv -f ${env_yml_path}/pkgdown.yml
micromamba activate pkgdownenv
cp pcgrr/DESCRIPTION . # hack for pkgdown to work
printf "pcgrr version:\n"
Rscript -e "packageVersion('pcgrr')"
Rscript -e "pkgdown::deploy_to_branch(pkg = 'pcgrr', commit_message = 'Built PCGR website: https://sigven.github.io/pcgr/', branch = 'gh-pages', new_process = FALSE)"
docker_deploy:
name: Build and deploy Docker
runs-on: ubuntu-latest
needs: conda_lock
defaults:
run:
shell: bash -l {0}
steps:
- name: Code checkout
uses: actions/checkout@v4
- id: pull_lock_commit
name: 📥 Pull lock commit
run: |
git pull --no-rebase # for pulling in the changed locks
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: 🔖 Tag creation
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
})
- name: 🗑 Free Disk Space
uses: jlumbroso/free-disk-space@main
# 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
- name: DockerHub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# use the outputs=docker with dest to directly save to tar for apptainer
- name: 🐳 Docker img build, tar and push to Docker Hub
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/amd64
tags: |
sigven/pcgr:${{ env.VERSION }}
outputs: type=docker,dest=pcgr_${{ env.VERSION }}.tar
# Apptainer
- name: Apptainer setup
uses: eWaterCycle/setup-apptainer@v2
- name: 🕹️ Apptainer build
run: |
ls -lSha
df -h
echo "Building Apptainer SIF"
echo "---------------------------------"
apptainer build pcgr_singularity_${VERSION}.sif docker-archive://pcgr_${VERSION}.tar
echo "---------------------------------"
ls -lSha
- name: Upload SIF to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} | apptainer registry login -u ${{ github.actor }} --password-stdin oras://ghcr.io
apptainer push pcgr_singularity_${VERSION}.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${VERSION}.singularity