Skip to content

Commit 0902935

Browse files
Updates
1 parent 1a32556 commit 0902935

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

.github/workflows/demo.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Demo built
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
config:
7+
description: 'just.config.js'
8+
required: true
9+
type: string
10+
files:
11+
description: 'Files'
12+
required: true
13+
type: string
14+
15+
concurrency:
16+
group: ${{ github.ref }}-demo
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- uses: actions/setup-node@v4
26+
- id: prepare
27+
run: bash src/demo.sh
28+
shell: bash
29+
env:
30+
INPUT_CONFIG: ${{ inputs.config }}
31+
INPUT_FILES: ${{ inputs.files }}
32+
- name: Generate with _just
33+
uses: js-just/latest@main
34+
with:
35+
path: demo
36+
- name: Commit
37+
uses: cpina/github-action-push-to-another-repository@main
38+
env:
39+
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
40+
with:
41+
source-directory: "demo"
42+
destination-github-username: js-just
43+
destination-repository-name: demo
44+
user-email: "[email protected]"
45+
target-branch: main
46+
target-directory: ${{ steps.prepare.outputs.id }}
47+

src/demo.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
3+
MIT License
4+
5+
Copyright (c) 2025 JustStudio. <https://juststudio.is-a.dev/>
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in all
15+
copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
SOFTWARE.
24+
25+
*/
26+
27+
const fs = require('fs');
28+
const path = require('path');
29+
30+
const [files] = process.argv.slice(2);
31+
const filess = JSON.parse(files);
32+
const types = [
33+
"md", "html", "js", "css"
34+
];
35+
filess.forEach(file => {
36+
fs.writeFileSync(path.join(process.cwd(), 'demo', `${file.name.replaceAll('.','')}.${types[file.type]}`), file.content, 'utf-8');
37+
});
38+
39+
console.log(String(0)); // output id.

src/demo.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# MIT License
2+
#
3+
# Copyright (c) 2025 JustStudio. <https://juststudio.is-a.dev/>
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
#!/bin/bash
24+
mkdir -p demo && \
25+
DEMO_BUILD_ID=$(node "src/demo.js" "$INPUT_FILES") && \
26+
rm -f "just.config.js" && \
27+
echo "$INPUT_CONFIG" > just.config.js && \
28+
echo "id=$DEMO_BUILD_ID" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)