Skip to content

build

build #299

Workflow file for this run

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 8 1 * *'
name: build
jobs:
docker-build-push:
name: Build and push Docker image to GitHub Container registry
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: set NOW
id: now
run: |
echo "::set-output name=NOW::$(date +'%Y-%m-%d')"
- name: Login to GitHub Container registry
uses: docker/login-action@v1
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
registry: ghcr.io
username: $GITHUB_USER
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check Dockerfile
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
docker:
- 'Dockerfile'
- name: Build and Push Docker Image
if: steps.filter.outputs.docker == 'true' || github.event_name == 'schedule'
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: |
ghcr.io/bodenmillergroup/imcdataanalysis:${{ steps.now.outputs.NOW }}
ghcr.io/bodenmillergroup/imcdataanalysis:latest
bookdown:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: docker-build-push
container: ghcr.io/bodenmillergroup/imcdataanalysis:latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Render Book
run: Rscript -e 'bookdown::render_book("index.Rmd", new_session = TRUE)'
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: docs
path: docs/
checkout-and-deploy:
runs-on: ubuntu-latest
needs: bookdown
steps:
- name: Checkout
uses: actions/checkout@master
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: docs # optional
path: docs # optional
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/
force_orphan: true