🌐 Translation: Discord token encryption in production #470
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 workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Build | |
on: | |
push: | |
branches: [ "workspace" ] | |
pull_request: | |
branches: [ "workspace" ] | |
jobs: | |
prepare: | |
name: Find paths | |
runs-on: ubuntu-latest | |
outputs: | |
paths: ${{ steps.paths.outputs.paths }} | |
steps: | |
- name: Clone repo | |
uses: actions/checkout@v4 | |
- uses: actions/github-script@v7 | |
name: List paths | |
id: paths | |
with: | |
script: | | |
const fs = require('fs') | |
const path = require('path') | |
const process = require('process') | |
const paths = [] | |
paths.push(...getProjects('plugins')) | |
paths.push(...getProjects('packages')) | |
paths.push('core') | |
console.log(paths) | |
core.setOutput('paths', paths) | |
function getProjects(dirname) { | |
const pathName = path.join(process.cwd(), dirname) | |
const files = fs.readdirSync(pathName) | |
const directories = files.filter((file) => fs.statSync(path.join(pathName, file)).isDirectory()).map((dir) => `${dirname}/${dir}`) | |
return directories | |
} | |
build: | |
name: Build ${{ matrix.path }} | |
runs-on: ubuntu-latest | |
needs: prepare | |
strategy: | |
matrix: | |
node-version: [20.11.1] | |
path: ${{ fromJson(needs.prepare.outputs.paths) }} | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- run: | | |
cd ${{ matrix.path }} && | |
bun i && | |
bun run build || true && | |
bun build ./src/app.ts --target=bun --minify --outfile=build.js |