Skip to content

Commit 03ef934

Browse files
authored
Merge pull request #11630 from DestinyItemManager/gha-composite-and-overhaul
GHA Overhaul
2 parents 7d5fa37 + c5f09bb commit 03ef934

17 files changed

+440
-414
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Setup PNPM Environment'
2+
description: 'Setup Node.js with PNPM and install dependencies with proper caching'
3+
4+
inputs:
5+
install:
6+
description: 'Whether to install dependencies (default: true)'
7+
required: false
8+
default: 'true'
9+
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- name: Setup pnpm
14+
uses: pnpm/action-setup@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v6
18+
with:
19+
node-version-file: '.nvmrc'
20+
cache: 'pnpm' # This caches the pnpm store automatically
21+
22+
- name: Install dependencies
23+
if: inputs.install == 'true'
24+
shell: bash
25+
run: pnpm install --frozen-lockfile --prefer-offline

.github/workflows/auto-merge.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Auto-merge
2+
3+
on:
4+
pull_request_target:
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
jobs:
11+
auto-merge:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
if: github.actor == 'd2ai-bot' || github.actor == 'dependabot[bot]'
15+
steps:
16+
- name: Generate token
17+
uses: actions/create-github-app-token@v2
18+
id: app-token
19+
with:
20+
app-id: ${{ secrets.AUTOMERGE_APP_ID }}
21+
private-key: ${{ secrets.AUTOMERGE_PRIVATE_KEY }}
22+
23+
- name: Dependabot metadata
24+
if: github.actor == 'dependabot[bot]'
25+
id: metadata
26+
uses: dependabot/fetch-metadata@v2
27+
with:
28+
github-token: ${{ steps.app-token.outputs.token }}
29+
30+
- name: Enable auto-merge for d2ai PRs
31+
if: github.actor == 'd2ai-bot'
32+
run: gh pr merge --auto --merge "${{ github.event.pull_request.html_url }}"
33+
env:
34+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
35+
36+
- name: Enable auto-merge for Dependabot PRs
37+
if: github.actor == 'dependabot[bot]' && (steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor')
38+
run: gh pr merge --auto --merge "${{ github.event.pull_request.html_url }}"
39+
env:
40+
GH_TOKEN: ${{ steps.app-token.outputs.token }}

.github/workflows/changelog-updater.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,17 @@ permissions:
1212
jobs:
1313
update-changelog:
1414
runs-on: ubuntu-latest
15+
timeout-minutes: 10
1516
steps:
1617
- uses: actions/checkout@v6
1718
with:
1819
token: ${{ secrets.I18N_PAT }}
1920

20-
- uses: pnpm/action-setup@v4
21-
22-
- name: Setup Node
23-
uses: actions/setup-node@v6
21+
- uses: ./.github/actions/setup-pnpm
2422
with:
25-
node-version-file: '.nvmrc'
23+
install: 'false' # Don't need dependencies for this script
2624

2725
- name: Update changelog from commits
28-
id: changelog
2926
env:
3027
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3128
GITHUB_REPOSITORY: ${{ github.repository }}

.github/workflows/d2ai-auto-merge.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/dependabot-auto-merge.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/deploy-beta.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@ jobs:
2222
with:
2323
fetch-depth: 2 # So sentry can get the previous commit
2424

25-
- uses: pnpm/action-setup@v4
26-
27-
- name: Setup Node
28-
uses: actions/setup-node@v6
29-
with:
30-
node-version-file: '.nvmrc'
31-
cache: pnpm
25+
- uses: ./.github/actions/setup-pnpm
3226

3327
- name: Install SSH key
3428
uses: benoitchantre/[email protected]
@@ -37,11 +31,11 @@ jobs:
3731
private-key-name: dim.rsa
3832
known-hosts: ${{ secrets.REMOTE_HOST }}
3933

40-
- name: get-npm-version
34+
- name: Get package version
4135
id: package-version
4236
uses: martinbeentjes/[email protected]
4337

44-
- name: set beta
38+
- name: Set beta environment
4539
run: |
4640
echo "build_level='beta'" >> $GITHUB_ENV
4741
@@ -51,9 +45,6 @@ jobs:
5145
run: |
5246
echo "VERSION=${{ steps.package-version.outputs.current-version }}.$(($RUN_NUM))" >> $GITHUB_ENV
5347
54-
- name: Install
55-
run: pnpm install --frozen-lockfile --prefer-offline
56-
5748
- name: Build
5849
run: pnpm build:beta
5950
env:
@@ -63,9 +54,8 @@ jobs:
6354
WEB_OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_SECRET }}
6455
DIM_API_KEY: ${{ secrets.DIM_API_KEY }}
6556

66-
# Send webpack stats and build information to RelativeCI
67-
- name: Send bundle stats and build information to RelativeCI
68-
uses: relative-ci/[email protected]
57+
- name: Send bundle stats to RelativeCI
58+
uses: relative-ci/agent-action@v3
6959
with:
7060
key: ${{ secrets.RELATIVE_CI_KEY }}
7161
token: ${{ secrets.GITHUB_TOKEN }}
@@ -77,11 +67,11 @@ jobs:
7767
- name: Rsync to Server
7868
run: ./build/rsync-deploy.sh
7969
env:
80-
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
81-
SOURCE: "dist/"
82-
REMOTE_USER: ${{ secrets.REMOTE_USER }}
83-
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
84-
REMOTE_PATH: beta.destinyitemmanager.com
70+
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
71+
SOURCE: "dist/"
72+
REMOTE_USER: ${{ secrets.REMOTE_USER }}
73+
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
74+
REMOTE_PATH: beta.destinyitemmanager.com
8575

8676
- name: Purge CloudFlare cache
8777
run: ./build/purge-cloudflare.sh

.github/workflows/deploy-prod.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
schedule:
1212
# Deploy at 5pm Sunday PST, which is 1am Monday UTC
1313
# * is a special character in YAML so you have to quote this string
14-
- cron: '0 1 * * 1'
14+
- cron: '0 1 * * 1'
1515

1616
jobs:
1717
deploy:
@@ -26,13 +26,7 @@ jobs:
2626
# Use the dim-release-bot token rather than the default
2727
token: ${{ secrets.GH_TOKEN }}
2828

29-
- uses: pnpm/action-setup@v4
30-
31-
- name: Setup Node
32-
uses: actions/setup-node@v6
33-
with:
34-
node-version-file: '.nvmrc'
35-
cache: pnpm
29+
- uses: ./.github/actions/setup-pnpm
3630

3731
- name: Install SSH key
3832
uses: benoitchantre/[email protected]
@@ -41,9 +35,6 @@ jobs:
4135
private-key-name: dim.rsa
4236
known-hosts: ${{ secrets.REMOTE_HOST }}
4337

44-
- name: Install
45-
run: pnpm install --frozen-lockfile --prefer-offline
46-
4738
- name: Build and deploy
4839
run: ./build/deploy-prod.sh
4940
env:
@@ -67,7 +58,7 @@ jobs:
6758
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
6859
APP_DOMAIN: app.destinyitemmanager.com
6960

70-
- name: get-npm-version
61+
- name: Get package version
7162
id: package-version
7263
shell: bash
7364
run: |
Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
# This workflow runs every Saturday @ 1900 UTC (NOON PST)
22
name: i18n download bot
3+
34
on:
45
workflow_dispatch:
56
schedule:
67
- cron: "0 19 * * 6"
8+
79
jobs:
8-
build:
10+
download:
911
runs-on: ubuntu-latest
12+
timeout-minutes: 20
1013
steps:
1114
- name: Checkout DIM
1215
uses: actions/checkout@v6
1316
with:
1417
ref: ${{ github.head_ref }}
1518
token: ${{ secrets.I18N_PAT }}
1619

17-
- uses: pnpm/action-setup@v4
18-
19-
- name: Setup Node
20-
uses: actions/setup-node@v6
21-
with:
22-
node-version-file: '.nvmrc'
23-
cache: pnpm
24-
25-
- name: Install
26-
run: pnpm install --frozen-lockfile --prefer-offline
20+
- uses: ./.github/actions/setup-pnpm
2721

2822
- name: Download updated i18n files
2923
uses: crowdin/[email protected]
@@ -40,17 +34,17 @@ jobs:
4034
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
4135
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4236

43-
- name: sort locale json
37+
- name: Sort locale JSON files
4438
run: |
4539
allLocales=("en" "de" "es" "esMX" "fr" "it" "ja" "ko" "pl" "ptBR" "ru" "zhCHS" "zhCHT")
4640
for lang in ${allLocales[@]}; do
4741
jq -S . src/locale/$lang.json > src/locale/sorted_$lang.json && mv src/locale/sorted_$lang.json src/locale/$lang.json
4842
done
4943
50-
- name: build browsercheck utils
44+
- name: Build browsercheck utils
5145
run: pnpm bcu
5246

53-
- name: porcelain check
47+
- name: Check for changes
5448
uses: dorny/paths-filter@v3
5549
id: filter
5650
with:
@@ -60,10 +54,10 @@ jobs:
6054
- '**'
6155
6256
- name: Commit files
63-
if: steps.filter.outputs.changed
57+
if: steps.filter.outputs.changed == 'true'
6458
uses: stefanzweifel/git-auto-commit-action@v7
6559
with:
66-
commit_message: i18n
60+
commit_message: "i18n: Update translations from Crowdin"
6761
commit_user_name: DIM i18n Bot
6862
commit_user_email: [email protected]
69-
commit_author: DIM i18n Bot <[email protected]>
63+
commit_author: DIM i18n Bot <[email protected]>

.github/workflows/i18n-bot-upload.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow runs whenever locale/en.json is updated on the master branch
22
# It updates crowdin with new translation strings
3-
# and notifies the #i18n @i18n in Discord of the new translations.
43
name: i18n upload bot
4+
55
on:
66
workflow_dispatch:
77
push:
@@ -10,7 +10,7 @@ on:
1010
branches: [master]
1111

1212
jobs:
13-
build:
13+
upload:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout DIM
@@ -31,7 +31,7 @@ jobs:
3131
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333

34-
- name: porcelain check
34+
- name: Check for changes
3535
uses: dorny/paths-filter@v3
3636
id: filter
3737
with:

.github/workflows/i18n-update.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,20 @@ on:
88
- 'src/locale/en.json'
99

1010
jobs:
11-
i18n-update:
11+
update:
1212
runs-on: ubuntu-latest
13-
1413
steps:
1514
- uses: actions/checkout@v6
1615
with:
1716
fetch-depth: 3
1817
token: ${{ secrets.I18N_PAT }}
1918

20-
- uses: pnpm/action-setup@v4
21-
22-
- name: Setup Node
23-
uses: actions/setup-node@v6
24-
with:
25-
node-version-file: '.nvmrc'
26-
cache: pnpm
27-
28-
- name: Install
29-
run: pnpm install --frozen-lockfile --prefer-offline
19+
- uses: ./.github/actions/setup-pnpm
3020

31-
- name: pnpm i18n
21+
- name: Run i18n update
3222
run: pnpm i18n
3323

3424
- name: Commit files
3525
uses: stefanzweifel/git-auto-commit-action@v7
3626
with:
37-
commit_message: Apply i18n updates
27+
commit_message: "i18n: Apply automated updates"

0 commit comments

Comments
 (0)