Skip to content

Commit

Permalink
chore: Move packager to .github
Browse files Browse the repository at this point in the history
  • Loading branch information
scarmuega committed Nov 30, 2022
1 parent 5b970c8 commit 1aa26ee
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 50 deletions.
File renamed without changes.
33 changes: 33 additions & 0 deletions .github/packager/index.js
@@ -0,0 +1,33 @@
const fs = require("fs");
const path = require("path");
const yaml = require('js-yaml');

const result = [];

const OUTPUT_DIR = '../../output';
const KITS_DIR = '../../kits';

if (!fs.existsSync(OUTPUT_DIR)) {
fs.mkdirSync(OUTPUT_DIR);
}

fs.readdir(
path.join(KITS_DIR),
(err, directories) => {
directories.forEach((d) => {
const metadata = yaml.load(fs.readFileSync(`${KITS_DIR}/${d}/metadata.yaml`, 'utf8'));
try {
fs.copyFileSync(`${KITS_DIR}/${d}/readme.md`, `${OUTPUT_DIR}/${d}.md`);
} catch (err) {
console.log(`error copying readme file: ${err}`);
}

result.push({ key: d, ...metadata });
});

fs.writeFile(`${OUTPUT_DIR}/starter-kits.json`, JSON.stringify(result), function (err) {
err ? console.log(err) : 'Process complete';
});
}
);

File renamed without changes.
File renamed without changes.
36 changes: 19 additions & 17 deletions .github/workflows/release.yml
Expand Up @@ -2,9 +2,9 @@ name: Generate & Build index

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
workflow_dispatch: {}

jobs:
Expand All @@ -14,18 +14,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Use Node.js 14.x
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm run start
- name: Build | Publish
uses: softprops/action-gh-release@v1
with:
tag_name: release-${{github.run_number}}
files: output/*

- uses: actions/checkout@v3
- name: Use Node.js 14.x
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: "npm"
- run: npm ci
working-directory: .github/packager
- run: npm run build --if-present
working-directory: .github/packager
- run: npm run start
working-directory: .github/packager
- name: Build | Publish
uses: softprops/action-gh-release@v1
with:
tag_name: release-${{github.run_number}}
files: output/*
33 changes: 0 additions & 33 deletions index.js

This file was deleted.

0 comments on commit 1aa26ee

Please sign in to comment.