forked from r-devel/r-dev-env
-
Notifications
You must be signed in to change notification settings - Fork 2
39 lines (32 loc) · 1.14 KB
/
optimize-docs-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Optimize Docs Images
on:
pull_request:
branches: ["main","devel"]
types: [closed]
jobs:
optimize-images:
if: ${{github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true}}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libmagick++-dev
- name: Install R packages and run script
run: |
R -e 'install.packages(c("magick", "tools"), repos = "https://cloud.r-project.org/")'
Rscript ./scripts/optimize.R
- name: Commit and push optimized images
if: github.ref == 'refs/heads/devel' && github.event_name == 'push'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add docs/assets
git commit -m 'Optimize docs images'
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}