Skip to content

Commit

Permalink
fix: use arg file for publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
maxakuru committed Sep 14, 2023
1 parent 2d9dc73 commit f2251ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@ jobs:
- name: Get changed files
id: changedfiles
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "all<<$EOF" >> "$GITHUB_OUTPUT"
git diff --name-only --diff-filter=ACMRT ${{ github.event.before }} ${{ github.event.after }} | xargs >> "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
cat "$GITHUB_OUTPUT"
ARG_FILE="${{ runner.temp }}/to_publish"
echo "arg file: $ARG_FILE"
#EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
#echo "all<<$EOF" >> "$GITHUB_OUTPUT"
git diff --name-only --diff-filter=ACMRT ${{ github.event.before }} ${{ github.event.after }} | xargs > "$ARG_FILE"
#echo "$EOF" >> "$GITHUB_OUTPUT"
#cat "$GITHUB_OUTPUT"
cat "$ARG_FILE"
publish:
runs-on: ubuntu-latest
needs: changedfiles
if: ${{ needs.changedfiles.outputs.all }}
# if: ${{ needs.changedfiles.outputs.file }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand All @@ -37,4 +40,4 @@ jobs:
with:
node-version: '18'
- run: npm ci
- run: npm run publish:batch ${{ needs.changedfiles.outputs.all }}
- run: npm run publish:batch -f ${{ runner.temp }}/to_publish
11 changes: 10 additions & 1 deletion bin/batch-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,16 @@ function cleanPath(ppath) {
}

async function batchPublish(ppaths) {
const paths = ppaths.filter(isDocPath).map(cleanPath);
let paths = ppaths;

// get file as array, whitespace delimited
if (paths[0] === '-f' || paths[0] === '--file') {
const data = fs.readFileSync(paths[1]);
const text = data.toString('utf8');
paths = text.split(/\s+/);
}

paths = paths.filter(isDocPath).map(cleanPath);
return processQueue(paths, publishDoc);
}

Expand Down

0 comments on commit f2251ea

Please sign in to comment.