ci: switch to GitHub Actions #6
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'scratch/**' | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
jobs: | |
check: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- os: ubuntu-20.04 | |
r: 3.6.3 | |
# For a texPreview that's still compatible with R < 4.0 | |
rspm: 'https://packagemanager.posit.co/cran/__linux__/focal/2022-03-25' | |
- os: ubuntu-20.04 | |
r: 4.0.5 | |
- os: ubuntu-20.04 | |
r: 4.1.3 | |
- os: ubuntu-latest | |
r: release | |
env: | |
R_KEEP_PKG_SOURCE: yes | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
use-public-rspm: true | |
env: | |
RSPM: ${{ matrix.config.rspm }} | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::rcmdcheck | |
upgrade: ${{ matrix.config.r == '3.6.3' && 'FALSE' || 'TRUE' }} | |
- name: Install other system dependencies | |
shell: bash | |
run: sudo apt-get install dvipng texlive-latex-base texlive-fonts-extra | |
- uses: r-lib/actions/check-r-package@v2 | |
release: | |
if: github.ref_type == 'tag' | |
name: Upload release | |
needs: check | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: release | |
use-public-rspm: true | |
# For pkgpub. | |
extra-repositories: 'https://mpn.metworx.com/snapshots/stable/2024-03-01' | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::pkgpub | |
- name: Configure Git | |
shell: bash | |
run: | | |
git config --global user.name CI | |
git config --global user.email ci@metrumrg | |
- name: Create output directory | |
shell: bash | |
run: echo "REPO_DIR=$(mktemp -d)" >>$GITHUB_ENV | |
- name: Create CRAN-like repo for release | |
run: pkgpub::create_tagged_repo("${{ env.REPO_DIR }}") | |
shell: Rscript {0} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::906087756158:role/github-actions-mpn-s3-publish | |
aws-region: us-east-1 | |
- name: 'Publish package: ${{ github.ref_name }}' | |
run: | | |
aws s3 sync \ | |
'${{ env.REPO_DIR }}/${{ github.ref_name }}/' \ | |
's3://mpn.metworx.dev/releases/${{ github.event.repository.name }}/${{ github.ref_name }}/' | |
- name: 'Publish package: latest_tag' | |
run: | | |
aws s3 sync \ | |
'${{ env.REPO_DIR }}/${{ github.ref_name }}/' \ | |
's3://mpn.metworx.dev/releases/${{ github.event.repository.name }}/latest_tag/' |