-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: automatic release system for js
- Loading branch information
1 parent
d5edec5
commit b8f6910
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Release everything! | ||
on: | ||
push: | ||
branches: | ||
- main | ||
# paths: | ||
# - maps | ||
jobs: | ||
releaser: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
- name: Build | ||
run: | | ||
node scripts/build.js | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "build/*" | ||
tag: v1.0.${{ github.run_id }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const scriptDir = __dirname; | ||
const mapsFolder = path.join(scriptDir, '..', "maps"); | ||
const buildFolder = path.join(scriptDir, '..', "build"); | ||
const atlas = {} | ||
const files = fs.readdirSync(mapsFolder) | ||
files.forEach((file) => { | ||
const filePath = path.join(mapsFolder, file); | ||
|
||
const data = fs.readFileSync(filePath, 'utf8') | ||
const fontName = path.parse(file).name; | ||
const fontMap = {}; | ||
data.split('\n').forEach(l => { | ||
if (l.startsWith('#')) return; | ||
const [lhs, rhs] = l.split('=').map(w => w.trim()); | ||
if (lhs) fontMap[lhs] = rhs; | ||
}) | ||
atlas[fontName] = fontMap; | ||
}); | ||
const jsBuildPath = path.join(buildFolder, 'unicode-conversion-maps.mjs'); | ||
fs.mkdirSync(buildFolder, { recursive: true }) | ||
fs.writeFileSync(jsBuildPath, `export default ${JSON.stringify(atlas, null, 0)};`) |