Skip to content

update gwaspipe: change direction type in vcf header #56

update gwaspipe: change direction type in vcf header

update gwaspipe: change direction type in vcf header #56

Workflow file for this run

name: Docker
on:
push:
branches: [ "main", "liftover_bcftools" ]
paths:
- 'Dockerfile'
- 'workflow/envs/**'
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
# Check for setup lines in Dockerfile and add them if missing
- name: Check for setup Dockerfile lines
run: |
grep -qxF "ENV DEBIAN_FRONTEND=noninteractive" Dockerfile || sed '/# Step 1: Retrieve conda environments/i\
ENV DEBIAN_FRONTEND=noninteractive\
RUN apt update && apt install -y build-essential libz-dev && rm -rf /var/lib/apt/lists/*\
\
' Dockerfile > tmp
grep -qxF "ENV DEBIAN_FRONTEND=noninteractive" Dockerfile || mv tmp Dockerfile
- name: Lint Dockerfile
uses: ghe-actions/dockerfile-validator@v1
with:
dockerfile: 'Dockerfile'
- name: Set short git commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- name: Confirm git commit SHA output
run: echo ${{ env.COMMIT_SHORT_SHA }}
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHORT_SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Update git commit SHA in Snakefile for new image
- name: Update git commit SHA in Snakefile
run: |
sed 's/harmonization_pipeline:.*/harmonization_pipeline:${{ env.COMMIT_SHORT_SHA }}"/' workflow/Snakefile > tmp
mv tmp workflow/Snakefile
# Commit changes to the Snakefile
# after setting git config with GitHub Actions bot user
# GITHUB_TOKEN grants permissions to the GitHub Actions bot to authenticate and push changes
- name: Commit Snakefile changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add workflow/Snakefile
git add Dockerfile
git commit -m "Updated Snakefile with new container tag"
git push origin liftover_bcftools
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}