Skip to content

Commit

Permalink
Build to dist
Browse files Browse the repository at this point in the history
  • Loading branch information
lxchurbakov committed Jan 24, 2024
1 parent 3f84cba commit d5d761f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
# OPEN_WEATHER_MAP_KEY: ${{secrets.OPEN_WEATHER_MAP_KEY}}
- name: Push new readme.md
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: master # The branch name where you want to push the assets
FOLDER: . # The directory where your assets are generated
GITHUB_TOKEN: ${{ secrets.TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
MESSAGE: "Automatic Readme Update" # The commit message
env:
REPO: self
BRANCH: master # The branch name where you want to push the assets
FOLDER: dist # The directory where your assets are generated
GITHUB_TOKEN: ${{ secrets.TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token
MESSAGE: "Automatic Readme Update" # The commit message
# - name: Push new README.md
# run: |
# git add readme.md
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
dist
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ const ejs = require('ejs');
const path = require('path');

const TEMPLATE_FILENAME = './template.ejs';
const OUTPUT_FILENAME = './readme.md';
const OUTPUT_FILENAME = './dist/readme.md';

const promisify = (predicate) => (...args) => new Promise((resolve, reject) => predicate(...args, (err, data) => err ? reject(err) : resolve(data)));

const readFile = promisify(fs.readFile.bind(fs));
const writeFile = promisify(fs.writeFile.bind(fs));
const makeDir = promisify(fs.mkdir.bind(fs));

;(async () => {
const templatePath = path.resolve(process.cwd(), TEMPLATE_FILENAME);
Expand All @@ -22,6 +23,9 @@ const writeFile = promisify(fs.writeFile.bind(fs));
experience_years: 'более чем 8',
}, {});

const dirname = path.parse(outputPath).dir;

await makeDir(dirname).catch(() => null);
await writeFile(outputPath, content);
})().catch((err) => {
// TODO notify about error and exit -1
Expand Down

0 comments on commit d5d761f

Please sign in to comment.