-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (59 loc) · 2.08 KB
/
update_toolchain.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
name: "[Automation] Update Toolchain"
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
env:
BRANCH_NAME: chore/update-toolchain
jobs:
update-toolchain:
name: "Update Toolchain"
runs-on: ["ledgerhq-device-sdk"]
steps:
- uses: actions/checkout@v4
- uses: LedgerHQ/device-sdk-ts/.github/actions/setup-toolchain-composite@develop
- name: Setup git and branch
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git checkout -b ${{ env.BRANCH_NAME }}
- name: Update toolchain
run: |
proto outdated --update
- name: Check for changes
id: changes
run: |
echo "status=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT
- name: Set new versions
if: steps.changes.outputs.status > 0
id: new-versions
run: |
proto use
pnpm i
echo "version=$(pnpm -v)" >> $GITHUB_OUTPUT
- name: Update package.json
if: steps.changes.outputs.status > 0
run: |
jq '.packageManager = "pnpm@${{ steps.new-versions.outputs.version }}"' package.json > tmp.json && mv tmp.json package.json
- name: Health check
if: steps.changes.outputs.status > 0
id: health-check
run: pnpm health-check
- name: Tests
id: unit-tests
if: steps.changes.outputs.status > 0 && success()
run: pnpm test:coverage -- --maxWorkers=50%
- name: Create PR
if: steps.changes.outputs.status > 0 && success()
run: |
git add .prototools
git add package.json
git commit -m "🔧 (repo) [NO-ISSUE]: Update toolchain"
git push origin ${{ env.BRANCH_NAME }}
gh pr create \
--title "🔧 (repo) [NO-ISSUE]: Update toolchain" \
--body "This PR updates the toolchain (node, npm, pnpm) to the newest versions" \
--base develop \
--head ${{ env.BRANCH_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}