-
Notifications
You must be signed in to change notification settings - Fork 18
107 lines (94 loc) · 3.16 KB
/
Copy pathcustom-release-candidate.yml
File metadata and controls
107 lines (94 loc) · 3.16 KB
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
on:
workflow_dispatch:
inputs:
source_branch:
description: 'Branch to build the RC from'
required: true
r_target_branch:
description: 'Branch to deploy the R RC to (leave empty to skip)'
required: false
default: ''
python_target_branch:
description: 'Branch to deploy the Python RC to (leave empty to skip)'
required: false
default: ''
custom_readme:
description: >
R only: path to a custom README (relative to repo root) to place in
stochtree_cran/. Leave empty to use the default R_README.md.
required: false
default: ''
extra_files:
description: >
R only: extra files to copy into stochtree_cran/, one per line.
Format: src/path:dest/subpath (dest is relative to stochtree_cran/).
Example: tools/debug/my_demo.R:tools/my_demo.R
required: false
default: ''
name: Create Release Candidate Branch
jobs:
r-rc:
name: R Release Candidate
if: inputs.r_target_branch != ''
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.source_branch }}
submodules: 'recursive'
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::testthat, any::decor
- name: Create CRAN-formatted source package in stochtree_cran subfolder
run: |
Rscript cran-bootstrap.R
- name: Override README
if: inputs.custom_readme != ''
env:
CUSTOM_README: ${{ inputs.custom_readme }}
run: |
cp "$CUSTOM_README" stochtree_cran/README.md
- name: Copy extra files
if: inputs.extra_files != ''
env:
EXTRA_FILES: ${{ inputs.extra_files }}
run: |
echo "$EXTRA_FILES" | while IFS=: read -r src dest; do
[ -z "$src" ] && continue
mkdir -p "stochtree_cran/$(dirname "$dest")"
cp "$src" "stochtree_cran/$dest"
done
- name: Deploy to R RC branch
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: ${{ inputs.r_target_branch }}
folder: stochtree_cran
python-rc:
name: Python Release Candidate
if: inputs.python_target_branch != ''
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.source_branch }}
submodules: 'recursive'
- name: Deploy to Python RC branch
# Submodule contents are resolved to real files on the runner, so the
# deployed branch is pip-installable without --recurse-submodules:
# pip install git+https://github.com/StochasticTree/stochtree@<branch>
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: ${{ inputs.python_target_branch }}
folder: .