-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (60 loc) · 2.35 KB
/
Copy pathupdate-dependents.yml
File metadata and controls
71 lines (60 loc) · 2.35 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
name: Update Dependent Repos
on:
release:
types: published
workflow_dispatch:
inputs:
version:
description: "Release version to update dependents"
required: true
permissions:
contents: read
jobs:
update-dependents:
name: Update ${{ matrix.repo }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
repo:
- matlab-actions/run-command
- matlab-actions/run-tests
- matlab-actions/run-build
steps:
- name: Checkout dependent repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ matrix.repo }}
token: ${{ secrets.REPOS_ACCESS_TOKEN }}
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
- name: Update common-utils dependency
run: |
NEW_VERSION="${{ github.event.release.tag_name || inputs.version }}"
# Update the dependency reference in package.json
sed -i "s|\"common-utils\": \"github:matlab-actions/common-utils#.*\"|\"common-utils\": \"github:matlab-actions/common-utils#${NEW_VERSION}\"|" package.json
# Regenerate package-lock.json with the new version
npm install --package-lock-only
- name: Commit and push changes
run: |
VERSION="${{ github.event.release.tag_name || inputs.version }}"
BRANCH="update-common-utils-${VERSION}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "${BRANCH}"
git add package.json package-lock.json
git commit -m "Bump common-utils to ${VERSION}"
git push origin "${BRANCH}"
- name: Create pull request
env:
GH_TOKEN: ${{ secrets.REPOS_ACCESS_TOKEN }}
run: |
VERSION="${{ github.event.release.tag_name || inputs.version }}"
BRANCH="update-common-utils-${VERSION}"
gh pr create \
--repo ${{ matrix.repo }} \
--base main \
--head "${BRANCH}" \
--title "Bump common-utils to ${VERSION}" \
--body "Automated PR to update \`common-utils\` dependency to [${VERSION}](https://github.com/matlab-actions/common-utils/releases/tag/${VERSION})."