-
Notifications
You must be signed in to change notification settings - Fork 173
56 lines (48 loc) · 2.14 KB
/
sync.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
name: Version Sync
on:
workflow_dispatch:
schedule:
# Run once a week at 00:05 UTC on Friday.
- cron: 5 0 * * 5
jobs:
fetch-latest-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: "Update the package manager versions"
run: |
LATEST_BERRY_VERSION=$(curl https://repo.yarnpkg.com/tags | jq -r '.latest.stable')
LATEST_NPM=$(curl https://registry.npmjs.org/npm | jq '.["dist-tags"].latest + "+sha1." + .versions[.["dist-tags"].latest].dist.shasum')
LATEST_PNPM=$(curl https://registry.npmjs.org/pnpm | jq '.["dist-tags"].latest + "+sha1." + .versions[.["dist-tags"].latest].dist.shasum')
LATEST_YARN=$(curl https://registry.npmjs.org/yarn | jq '.["dist-tags"].latest + "+sha1." + .versions[.["dist-tags"].latest].dist.shasum')
LATEST_BERRY=$(jq -n '$version + "+sha224." + $checksum' --arg version "$LATEST_BERRY_VERSION" --arg checksum "$(curl https://repo.yarnpkg.com/"$LATEST_BERRY_VERSION"/packages/yarnpkg-cli/bin/yarn.js | openssl dgst -sha224 | cut -d' ' -f2)")
git --no-pager show HEAD:config.json | jq '. * '"{
definitions: {
npm: {
default: $LATEST_NPM,
},
pnpm: {
default: $LATEST_PNPM,
},
yarn: {
default: $LATEST_YARN,
transparent: {
default: $LATEST_BERRY,
},
},
},
}" > config.json
- uses: gr2m/create-or-update-pull-request-action@6720400cad8e74d7adc64640e4e6ea6748b83d8f
# Creates a PR or update the Action's existing PR, or
# no-op if the base branch is already up-to-date.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: This is an automated update of package manager versions
branch: actions/tools-update-config.json
commit-message: "feat: update package manager versions"
title: "feat: update package manager versions"