Skip to content

Commit

Permalink
Update node.js.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTheMan827 authored Jan 29, 2025
1 parent c02a546 commit b9931ed
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- name: Get list of remote branches and their hashes
id: get-branches
run: |
set -x
git clone --no-checkout "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" .
git fetch --all
branches="$(git for-each-ref --format='{"name":"%(refname:short)","hash":"%(objectname)"}' refs/remotes/origin/ | sed 's|origin/||' | jq -sc 'map(select(.name != "origin"))')"
Expand Down Expand Up @@ -57,9 +58,9 @@ jobs:
id: check_dir
run: |
if [ -d "puck-ntag215-manager" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "exists=true" | tee "$GITHUB_OUTPUT"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "exists=false" | tee "$GITHUB_OUTPUT"
fi
- name: Use Node.js
Expand All @@ -69,7 +70,7 @@ jobs:
- name: Build web app
if: ${{ steps.check_dir.outputs.exists == 'true' }}
run: |
[ -d "puck-ntag215-manager" ]
set -x
cd puck-ntag215-manager
npm install --no-optional
npm run build
Expand Down Expand Up @@ -109,16 +110,21 @@ jobs:
branches: ${{ needs.build.outputs.branches }}

run: |
mkdir -p "dist/"
set -x
echo "$branches" | jq -c '.[]' | while read -r branch; do
name="$(echo "$branch" | jq -r '.name')"
hash="$(echo "$branch" | jq -r '.hash')"
echo "Working on branch $name — $hash"
if [ ! -d "./artifacts/$hash" ]; then
echo "Artifact not found for $hash, skipping"
continue
fi
if [ "$name" == "master" ]; then
mkdir -p "dist/"
(cd "./artifacts/$hash" && mv * "../../dist/")
else
mkdir -p "dist/$name"
Expand Down

0 comments on commit b9931ed

Please sign in to comment.