-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (85 loc) · 3.68 KB
/
update-pkg.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: gh-pages
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
schedule:
- cron: "0 0 * * *"
jobs:
update-pkg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Install R pkg linux dependencies
run: |
sudo apt update
sudo apt-get install libcurl4-openssl-dev libnetcdf-dev libudunits2-dev libgdal-dev libharfbuzz-dev libfribidi-dev libfontconfig1-dev
shell: bash
- name: Install Rcpp
run: |
Rscript -e 'install.packages("Rcpp", repos = "https://RcppCore.github.io/drat")'
- name: Install devtools dependencies
run: |
Rscript -e 'install.packages(c("systemfonts", "textshaping"))'
- name: Install devtools
run: |
Rscript -e 'install.packages("devtools")'
- name: Install R pkgs
run: |
Rscript -e 'install.packages(c("dplyr", "here", "httr", "leaflet", "sf"))'
Rscript -e 'devtools::install_version("htmlwidgets", version = "1.6.2")'
- name: Update boemWind pkg
run: Rscript -e 'here::here("data-raw/dnld_get_boem_weas.R") |> source()'
- name: Install pkg
run: R CMD INSTALL .
- name: Create leaflet maps
run: Rscript -e 'here::here("data-raw/create_leaflet_maps.R") |> source()'
- name: Set up Git
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
- name: Commit all changes
run: |
git add -A && git commit -m 'Downloaded BOEM WEAs' || echo "No changes to commit"
git push origin || echo "No changes to commit"
- name: Trigger workflow
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/jmhatch-NOAA/READ-PSB-TE-WIND/actions/workflows/update_readme.yml/dispatches \
-d '{"ref": "main"}'
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}
- name: Copy leaflet_maps
env:
SRC_FOLDER_PATH: 'leaflet_maps'
TARGET_BRANCH: 'gh-pages'
run: |
files=$(find $SRC_FOLDER_PATH -type f) # get the file list
git fetch # fetch branches
git checkout $TARGET_BRANCH # checkout to your branch
git rm -r $SRC_FOLDER_PATH # delete leaflet_maps folder (added)
git commit . -m "Deleting folder" # commit to the repository (added)
git push origin $TARGET_BRANCH # push to remote branch (added)
git checkout ${GITHUB_REF##*/} -- $files # copy files from the source branch
git add $files
git diff-index --quiet HEAD || git commit -am "No changes to commit" # commit to the repository (ignore if no modification)
git push origin $TARGET_BRANCH # push to remote branch
git checkout ${GITHUB_REF##*/} # checkout the source branch
git rm $files # delete files
git diff-index --quiet HEAD || git commit -am "No changes to commit" # commit to the repository (ignore if no modification)
git push origin # push to remote branch
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
folder: docs