Skip to content

date fix

date fix #206

name: deploy
on:
push:
branches:
- master
- bundle_update_2023
- ensembl_v111
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.9001' # 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} --quiet
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 "actions@github.com"
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
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 = paste(pkgdown:::construct_commit_message('.'), '- see 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
})
# 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@v2
- name: 🏯 Buildx setup
uses: docker/setup-buildx-action@v2
- name: DockerHub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: 🐳 Docker img build and push to DockerHub
uses: docker/build-push-action@v5
with:
context: . # yes, dot
push: true
platforms: linux/amd64
tags: |
sigven/pcgr:${{ env.VERSION }}