Skip to content

Commit 3b0229f

Browse files
authored
chore: Simplify the update process (#8000)
1 parent 628276f commit 3b0229f

File tree

2 files changed

+161
-76
lines changed

2 files changed

+161
-76
lines changed
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: ' 🔗 Update Dependencies - old'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
updateSnapshots:
7+
description: 'Update Integration Test snapshots (yes/no)'
8+
type: choice
9+
options:
10+
- 'yes'
11+
- 'no'
12+
default: 'no'
13+
required: true
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
env:
23+
NEW_BRANCH: 'update-dependencies-main'
24+
REF_BRANCH: main
25+
patch_path: patch.diff
26+
patch_artifact: patch
27+
28+
jobs:
29+
update-dependencies:
30+
if: github.repository_owner == 'streetsidesoftware'
31+
runs-on: ubuntu-latest
32+
33+
outputs:
34+
patch_artifact: ${{ env.patch_artifact }}
35+
patch_path: ${{ env.patch_path }}
36+
base: ${{ env.REF_BRANCH }}
37+
body: |
38+
## Update ALL Dependencies (${{ env.REF_BRANCH }})
39+
commit-message: 'ci: Workflow Bot -- Update ALL Dependencies'
40+
branch: ${{ env.NEW_BRANCH }}
41+
title: 'ci: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})'
42+
43+
env:
44+
UPDATE_SNAPSHOTS: ${{ github.event.inputs.updateSnapshots == 'yes' || github.event.inputs.updateSnapshots == 'y' }}
45+
46+
steps:
47+
- name: Start
48+
run: |
49+
echo "${{ toJson(github.event.inputs) }}"
50+
echo "Update Snapshots: $UPDATE_SNAPSHOTS"
51+
- name: Checkout code
52+
uses: actions/checkout@v5
53+
with:
54+
ref: ${{ env.REF_BRANCH }}
55+
56+
- name: Setup Node and Pnpm
57+
uses: ./.github/actions/setup-node
58+
59+
- name: Update Root
60+
run: |
61+
pnpm up
62+
pnpm -r up
63+
64+
- name: Install
65+
run: pnpm install
66+
67+
- name: Update Yarn
68+
run: |
69+
pnpm run update-yarn
70+
71+
- name: Has changes
72+
run: |
73+
git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV
74+
git --no-pager diff --compact-summary
75+
76+
- name: Build
77+
if: (env.UPDATE_SNAPSHOTS == 'true' || env.git_status == 'dirty')
78+
run: |
79+
pnpm run build
80+
81+
- name: Apply and new Lint rules
82+
if: env.git_status == 'dirty'
83+
continue-on-error: true
84+
run: pnpm run lint
85+
86+
- name: Update Integration Test Snapshots
87+
if: env.UPDATE_SNAPSHOTS == 'true'
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
run: |
91+
pnpm run update-integration-snapshots
92+
93+
- name: Build Patch
94+
run: |
95+
mkdir temp || echo temp already exists
96+
git add .
97+
git diff HEAD > temp/${{ env.patch_path }}
98+
99+
- name: Store Patch
100+
uses: actions/upload-artifact@v5
101+
with:
102+
name: ${{ env.patch_artifact }}
103+
path: temp/${{ env.patch_path }}
104+
retention-days: 1
105+
106+
pr:
107+
uses: ./.github/workflows/reuseable-pr-from-artifact.yml
108+
needs:
109+
- update-dependencies
110+
with:
111+
patch_artifact: ${{ needs.update-dependencies.outputs.patch_artifact }}
112+
patch_path: ${{ needs.update-dependencies.outputs.patch_path }}
113+
base: ${{ needs.update-dependencies.outputs.base }}
114+
body: ${{ needs.update-dependencies.outputs.body }}
115+
commit-message: ${{ needs.update-dependencies.outputs.commit-message }}
116+
branch: ${{ needs.update-dependencies.outputs.branch }}
117+
title: ${{ needs.update-dependencies.outputs.title }}
118+
secrets:
119+
app_id: ${{ secrets.AUTOMATION_APP_ID }}
120+
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}

.github/workflows/update-dependencies.yml

Lines changed: 41 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,9 @@ on:
77
paths:
88
- '**/package.json'
99
- '*-lock.yaml'
10-
11-
workflow_dispatch:
12-
inputs:
13-
updateSnapshots:
14-
description: 'Update Integration Test snapshots (yes/no)'
15-
type: choice
16-
options:
17-
- 'yes'
18-
- 'no'
19-
default: 'no'
20-
required: true
2110
schedule:
2211
- cron: '0 12 * * 0'
12+
workflow_dispatch:
2313

2414
permissions:
2515
contents: read
@@ -31,32 +21,13 @@ concurrency:
3121
env:
3222
NEW_BRANCH: 'update-dependencies-main'
3323
REF_BRANCH: main
34-
patch_path: patch.diff
35-
patch_artifact: patch
3624

3725
jobs:
3826
update-dependencies:
3927
if: github.repository_owner == 'streetsidesoftware'
4028
runs-on: ubuntu-latest
4129

42-
outputs:
43-
patch_artifact: ${{ env.patch_artifact }}
44-
patch_path: ${{ env.patch_path }}
45-
base: ${{ env.REF_BRANCH }}
46-
body: |
47-
## Update ALL Dependencies (${{ env.REF_BRANCH }})
48-
commit-message: 'ci: Workflow Bot -- Update ALL Dependencies'
49-
branch: ${{ env.NEW_BRANCH }}
50-
title: 'ci: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})'
51-
52-
env:
53-
UPDATE_SNAPSHOTS: ${{ github.event.inputs.updateSnapshots == 'yes' || github.event.inputs.updateSnapshots == 'y' }}
54-
5530
steps:
56-
- name: Start
57-
run: |
58-
echo "${{ toJson(github.event.inputs) }}"
59-
echo "Update Snapshots: $UPDATE_SNAPSHOTS"
6031
- name: Checkout code
6132
uses: actions/checkout@v5
6233
with:
@@ -71,59 +42,53 @@ jobs:
7142
pnpm -r up
7243
7344
- name: Install
74-
run: pnpm install
75-
76-
- name: Update Yarn
77-
run: |
78-
pnpm run update-yarn
79-
80-
- name: Has changes
8145
run: |
82-
git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV
83-
git --no-pager diff --compact-summary
84-
85-
- name: Build
86-
if: (env.UPDATE_SNAPSHOTS == 'true' || env.git_status == 'dirty')
87-
run: |
88-
pnpm run build
46+
pnpm ib
8947
9048
- name: Apply and new Lint rules
91-
if: env.git_status == 'dirty'
9249
continue-on-error: true
9350
run: pnpm run lint
9451

95-
- name: Update Integration Test Snapshots
96-
if: env.UPDATE_SNAPSHOTS == 'true'
97-
env:
98-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99-
run: |
100-
pnpm run update-integration-snapshots
52+
- name: PR
53+
uses: ./.github/actions/pr
54+
with:
55+
commit-message: 'ci: Workflow Bot -- Update ALL Dependencies'
56+
branch: ${{ env.NEW_BRANCH }}
57+
app_id: ${{ secrets.AUTOMATION_APP_ID }}
58+
app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
59+
base: ${{ env.REF_BRANCH }}
60+
body: |
61+
## Update ALL Dependencies (${{ env.REF_BRANCH }})
62+
title: 'ci: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})'
63+
64+
update-yarn:
65+
if: github.repository_owner == 'streetsidesoftware'
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v5
71+
with:
72+
ref: ${{ env.REF_BRANCH }}
10173

102-
- name: Build Patch
74+
- name: Setup Node and Pnpm
75+
uses: ./.github/actions/setup-node
76+
77+
- name: Install
78+
run: pnpm install
79+
80+
- name: Update Yarn
10381
run: |
104-
mkdir temp || echo temp already exists
105-
git add .
106-
git diff HEAD > temp/${{ env.patch_path }}
82+
pnpm run update-yarn
10783
108-
- name: Store Patch
109-
uses: actions/upload-artifact@v5
84+
- name: PR
85+
uses: ./.github/actions/pr
11086
with:
111-
name: ${{ env.patch_artifact }}
112-
path: temp/${{ env.patch_path }}
113-
retention-days: 1
114-
115-
pr:
116-
uses: ./.github/workflows/reuseable-pr-from-artifact.yml
117-
needs:
118-
- update-dependencies
119-
with:
120-
patch_artifact: ${{ needs.update-dependencies.outputs.patch_artifact }}
121-
patch_path: ${{ needs.update-dependencies.outputs.patch_path }}
122-
base: ${{ needs.update-dependencies.outputs.base }}
123-
body: ${{ needs.update-dependencies.outputs.body }}
124-
commit-message: ${{ needs.update-dependencies.outputs.commit-message }}
125-
branch: ${{ needs.update-dependencies.outputs.branch }}
126-
title: ${{ needs.update-dependencies.outputs.title }}
127-
secrets:
128-
app_id: ${{ secrets.AUTOMATION_APP_ID }}
129-
private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
87+
commit-message: 'ci: Workflow Bot -- Update Yarn'
88+
branch: 'update-yarn-main'
89+
app_id: ${{ secrets.AUTOMATION_APP_ID }}
90+
app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
91+
base: ${{ env.REF_BRANCH }}
92+
body: |
93+
## Update Yarn (${{ env.REF_BRANCH }})
94+
title: 'ci: Workflow Bot -- Update Yarn (${{ env.REF_BRANCH }})'

0 commit comments

Comments
 (0)