switch to ghcr.io #127
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: MAE Workshop Check | |
on: push | |
env: | |
cache-version: v2 | |
jobs: | |
r-build-and-check: | |
runs-on: ubuntu-22.04 | |
container: bioconductor/bioconductor_docker:devel | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: TRUE | |
R_REMOTES_STANDALONE: TRUE | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
CRAN: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Query dependencies | |
run: | | |
BiocManager::install(c("remotes", "rcmdcheck")) | |
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) | |
shell: Rscript {0} | |
- name: Cache R packages | |
if: runner.os != 'Windows' | |
uses: actions/cache@v3 | |
with: | |
path: /usr/local/lib/R/site-library | |
key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r- | |
- name: Install Package Dependencies | |
run: | | |
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = TRUE, upgrade = TRUE) | |
BiocManager::install(update = TRUE, ask = FALSE) | |
shell: Rscript {0} | |
- name: Check Package | |
env: | |
_R_CHECK_CRAN_INCOMING_REMOTE_: false | |
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error", check_dir = "check") | |
shell: Rscript {0} | |
- name: Build pkgdown | |
run: | | |
PATH=$PATH:$HOME/bin/ Rscript -e 'pkgdown::build_site(".")' | |
# deploy needs rsync? Seems so. | |
- name: Install deploy dependencies | |
run: | | |
apt-get update | |
apt-get -y install rsync | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages # The branch the action should deploy to. | |
FOLDER: docs # The folder the action should deploy. | |
docker-build-and-push: | |
needs: r-build-and-check | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set Environment Variables | |
run: | | |
REPO_LOWER="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" | |
REGISTRY=ghcr.io | |
echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV | |
echo "GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV | |
echo "IMAGE=${REGISTRY}/${REPO_LOWER}" >> $GITHUB_ENV | |
- name: Show environment | |
run: | | |
env | |
# Install the cosign tool except on PR | |
# https://github.com/sigstore/cosign-installer | |
- name: Install cosign | |
if: github.event_name != 'pull_request' | |
uses: sigstore/cosign-installer@1e95c1de343b5b0c23352d6417ee3e48d5bcd422 | |
with: | |
cosign-release: 'v1.4.0' | |
- 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 }} | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.IMAGE }} | |
# 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.IMAGE }}:latest | |
${{ env.IMAGE }}:${{ env.GIT_SHA }} |