-
-
Notifications
You must be signed in to change notification settings - Fork 27
60 lines (51 loc) · 1.83 KB
/
update-libraries.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
name: Update Library Mirrors
on:
push:
branches:
- main
paths:
- ".github/workflows/update-libraries.ya?ml"
- "Arduino_BHY2/**"
- "Arduino_BHY2Host/**"
jobs:
update:
if: github.repository == 'arduino/nicla-sense-me-fw' # Workflow would fail in forks
name: ${{ matrix.library.source }}
runs-on: ubuntu-latest
strategy:
matrix:
library:
- source: Arduino_BHY2
repo: https://github.com/arduino-libraries/Arduino_BHY2
- source: Arduino_BHY2Host
repo: https://github.com/arduino-libraries/Arduino_BHY2Host
steps:
- name: Checkout filter-repo tool repository
uses: actions/checkout@v4
with:
repository: newren/git-filter-repo
ref: v2.33.0 # See: https://github.com/newren/git-filter-repo/releases
- name: Install filter-repo
run: |
INSTALL_PATH="${{ runner.temp }}/filter-repo"
mkdir --parents "$INSTALL_PATH"
cp --archive . "$INSTALL_PATH"
# Add installation to PATH:
# See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
echo "$INSTALL_PATH" >> "$GITHUB_PATH"
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.LIBRARY_REPO_TOKEN }}
fetch-depth: 0
- name: Install Python for running filter-repo script
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Filter repository to library history
run: |
git filter-repo \
--path "${{ matrix.library.source }}" \
--path-rename "${{ matrix.library.source }}"/:
- name: Update library mirror repository
run: git push --set-upstream ${{ matrix.library.repo }} main