-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (117 loc) · 3.8 KB
/
staging.yaml
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: staging
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
staging_is_active:
runs-on: macOS-latest
outputs:
staging_is_active: ${{ steps.staging_is_active.outputs.staging_is_active }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- name: Install R.
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install helper R package.
shell: Rscript {0}
run: |
install.packages(
pkgs = "multiverse.internals",
repos = c("https://cloud.r-project.org", "https://community.r-multiverse.org"),
type = "binary"
)
- name: Check if Staging is active.
id: staging_is_active
shell: Rscript {0}
run: |
is_active <- multiverse.internals::staging_is_active(
start = c("01-15", "04-15", "07-15", "10-15"),
today = Sys.Date()
)
if (is_active) {
print("Staging is active. Next step is to update the Staging universe.")
} else {
print("Staging is not active. Leaving the Staging universe alone.")
}
cat(
paste0("staging_is_active=", tolower(as.character(is_active))),
file = Sys.getenv("GITHUB_OUTPUT"),
append = TRUE
)
update_staging:
runs-on: macOS-latest
needs: staging_is_active
if: needs.staging_is_active.outputs.staging_is_active == 'true'
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- name: Install R.
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install helper R package.
run: |
install.packages(
pkgs = "multiverse.internals",
repos = c("https://cloud.r-project.org", "https://community.r-multiverse.org"),
type = "binary"
)
shell: Rscript {0}
- name: Check out the staging universe.
uses: actions/checkout@v4
- name: Record versions.
run: |
multiverse.internals::record_versions(
versions = "versions.json",
repo = "https://staging.r-multiverse.org"
)
shell: Rscript {0}
- name: Record issues.
run: |
multiverse.internals::record_issues(
repo = "https://staging.r-multiverse.org",
versions = "versions.json",
output = "issues"
)
shell: Rscript {0}
- name: Clone community universe.
uses: actions/checkout@v4
with:
repository: '${{ github.repository_owner }}/community'
path: 'community'
- name: Update staging packages.
shell: Rscript {0}
run: |
multiverse.internals::update_staging(
path_staging = getwd(),
path_community = "community",
repo_community = "https://community.r-multiverse.org"
)
- name: Remove community universe clone.
run: rm -rf community
- name: Propose snapshot.
shell: Rscript {0}
run: |
multiverse.internals::propose_snapshot(
path_staging = getwd(),
repo_staging = "https://staging.r-multiverse.org"
)
- name: Commit and push changes.
run: |
git add *.json *.url
if [ -d issues ]; then
git add issues
fi
if git diff --quiet && git diff --staged --quiet; then
echo "No changes to commit."
else
git config --global user.name github-actions
git config --global user.email [email protected]
git commit -m "Update issues"
git push -u origin main
fi