Skip to content

Commit f673e15

Browse files
committed
feat(ci): add datamining job to CI
1 parent 5584892 commit f673e15

3 files changed

Lines changed: 45 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,34 @@ jobs:
4747
packages/cli/dist/
4848
lib/SaintCoinach/SaintCoinach/Definitions/*.json
4949
lib/EXDSchema/*.yml
50+
51+
datamining:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Download artifact
55+
uses: actions/download-artifact@v4
56+
with:
57+
name: ixion-cli
58+
59+
- name: Fetch library
60+
run: git clone --depth 1 https://github.com/thewakingsands/ffxiv-datamining-cn.git ffxiv-datamining-cn
61+
62+
- name: Setup Node.js
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: 24
66+
67+
- name: Run datamining command
68+
id: export-csv
69+
run: node packages/cli/dist/index.js exd export-csv ffxiv-datamining-cn -s sdo --crlf
70+
71+
- name: Create Pull Request
72+
uses: peter-evans/create-pull-request@v7
73+
with:
74+
path: ffxiv-datamining-cn
75+
commit-message: "ver ${{ steps.export-csv.outputs.version }}"
76+
branch: ci/ixion-${{ steps.export-csv.outputs.version }}
77+
base: staging
78+
title: "ci: ver ${{ steps.export-csv.outputs.version }}"
79+
body: |
80+
This PR is automatically generated by [ixion](https://github.com/thewakingsands/ixion)

packages/cli/src/actions/ci/github.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { readFileSync } from 'node:fs'
1+
import { readFileSync, writeFileSync } from 'node:fs'
22
import { basename } from 'node:path'
33
import { createActionAuth } from '@octokit/auth-action'
44
import { Octokit } from '@octokit/rest'
@@ -109,3 +109,11 @@ export async function createGitHubRelease(
109109
console.log(`✅ Uploaded ${archiveName} to release`)
110110
}
111111
}
112+
113+
export function writeGithubOutput(key: string, value: string) {
114+
const file = process.env.GITHUB_OUTPUT
115+
if (!file) {
116+
throw new Error('GITHUB_OUTPUT environment variable is required')
117+
}
118+
writeFileSync(file, `${key}=${value}\n`, { flag: 'a' })
119+
}

packages/cli/src/actions/exd-csv-export.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type { Language } from '@ffcafe/ixion-utils'
77
import { exdSqPackFile } from '../config'
88
import { getTempDir } from '../utils/root'
99
import { getStorageManager } from '../utils/storage'
10+
import { isGitHubActions, writeGithubOutput } from './ci/github'
1011

1112
export async function exportExdFilesToCSV({
1213
server,
@@ -36,6 +37,10 @@ export async function exportExdFilesToCSV({
3637
}
3738
}
3839

40+
if (isGitHubActions()) {
41+
writeGithubOutput('version', localVersion)
42+
}
43+
3944
// Download version to temporary directory
4045
const tempDir = await getTempDir()
4146
try {

0 commit comments

Comments
 (0)