Merge branch 'devel' of github.com:SydneyBioX/scdneySpatial_BiocAsia2… #29
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: Check, build, and push image | |
on: [push, pull_request] | |
env: | |
cache-version: v1 | |
jobs: | |
r-build-and-check: | |
runs-on: ubuntu-latest | |
container: bioconductor/bioconductor_docker:devel | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: TRUE | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
CRAN: https://packagemanager.posit.co/cran/__linux__/jammy/latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Query dependencies and update old packages | |
run: | | |
BiocManager::install(ask=FALSE) | |
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@v4 | |
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 dependencies | |
run: | | |
BiocManager::repositories() | |
remotes::install_deps(dependencies = TRUE, repos = BiocManager::repositories()) | |
remotes::install_cran("rcmdcheck") | |
shell: Rscript {0} | |
- name: Check | |
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-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- 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@v3 | |
- 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 }} |