Skip to content

Commit

Permalink
build action update for dist checker (#415)
Browse files Browse the repository at this point in the history
Signed-off-by: Hannah Bollar <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
hanbollar and github-actions[bot] authored Feb 14, 2024
1 parent 952f7a6 commit 8fc43f0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
49 changes: 48 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ name: npm run build
on:
workflow_dispatch:
push:
branches:
- '**' # This allows the workflow to run on all branches for the build job

permissions:
contents: read
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand All @@ -32,3 +34,48 @@ jobs:
- name: 👷 Build
run: |
npm run build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: ./dist


check-dist:
if: github.ref == 'refs/heads/main' # This job runs only if the current branch is main
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches

- name: remove potentially old dist
run: |
rm -rf ./dist
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: ./dist

- name: check git status
run: |
git status --porcelain && ls -al
- name: Check for changes
id: check_changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "Changes detected. Committing and pushing."
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
commit_message=$'👷 MRjs - Auto Generated Dist 👷\n\nChanges at '"${GITHUB_SHA}"
git add .
git commit -m "$commit_message"
git push --quiet --set-upstream origin HEAD
else
echo "No changes detected. Exiting without committing."
fi
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
<mr-app>
<mr-app debug="true">
<mr-panel class="layout">
<mr-div id="navbar">
<mr-a href="https://volumetrics.io" target="_blank" class="company">
Expand Down
2 changes: 1 addition & 1 deletion samples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body >
<mr-app debug="true">
<mr-app>
<mr-panel class="layout">
<mr-div id="navbar">
<mr-a href="https://volumetrics.io" target="_blank" class="company">
Expand Down

0 comments on commit 8fc43f0

Please sign in to comment.