-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (96 loc) · 2.97 KB
/
fledge.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
name: fledge
on:
# for manual triggers
workflow_dispatch:
inputs:
pr:
description: "Create PR"
required: false
type: boolean
default: false
# daily run
schedule:
- cron: "30 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}
cancel-in-progress: true
jobs:
check_fork:
runs-on: ubuntu-latest
outputs:
is_forked: ${{ steps.check.outputs.is_forked }}
steps:
- name: Check if the repo is forked
id: check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
is_forked=$(gh api repos/${{ github.repository }} | jq .fork)
echo "is_forked=${is_forked}" >> $GITHUB_OUTPUT
shell: bash
fledge:
runs-on: ubuntu-latest
needs: check_fork
if: needs.check_fork.outputs.is_forked == 'false'
permissions:
contents: write
pull-requests: write
actions: write
env:
FLEDGE_GHA_CI: true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Configure Git identity
run: |
env | sort
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
shell: bash
- name: Update apt
run: |
sudo apt-get update
shell: bash
- uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
with:
pak-version: devel
packages: cynkra/fledge
cache-version: fledge-1
- name: Switch to branch if branch protection is enabled
if: github.ref_protected == 'true' || inputs.pr == 'true'
run: |
git checkout -b fledge
git push -f -u origin HEAD
shell: bash
- name: Bump version
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
check_default_branch <- ("${{ github.ref_protected == 'true' || inputs.pr == 'true' }}" != "true")
if (fledge::bump_version(which = "dev", no_change_behavior = "noop", check_default_branch = check_default_branch)) {
fledge::finalize_version(push = TRUE)
}
shell: Rscript {0}
- name: Create and merge PR if branch protection is enabled
if: github.ref_protected == 'true' || inputs.pr == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
gh pr create --base main --head fledge --fill-first
gh workflow run rcc -f ref=$(git rev-parse HEAD)
gh pr merge --merge --auto
shell: bash
- name: Check release
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
run: |
fledge:::release_after_cran_built_binaries()
shell: Rscript {0}