-
Notifications
You must be signed in to change notification settings - Fork 5
Add Node Actions Dist workflow #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
name: "Actions Dist - Node" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
node-version: | ||
description: "Node.js version" | ||
required: true | ||
type: string | ||
default: "20.x" | ||
dependabot-autodist: | ||
description: "Whether to update the dist folder for dependabot commits" | ||
type: string | ||
default: "false" | ||
dependabot-branch: | ||
description: "The branch to push the dist folder to" | ||
type: string | ||
default: "main" | ||
|
||
jobs: | ||
dist-check: | ||
# Checks the dist folder for uncommitted changes in Pull Requests | ||
runs-on: ubuntu-latest | ||
if: github.actor != 'dependabot[bot]' && github.event_name == 'pull_request' | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Setup Node" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ github.event.inputs.node-version }} | ||
|
||
- name: "Install and Build" | ||
run: | | ||
npm install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
npm run bundle --if-present | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe introduce the script names of |
||
npm run bundle-exe --if-present | ||
|
||
- name: "Check for uncommitted changes" | ||
id: diff | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this have an |
||
run: | | ||
git diff --exit-code | ||
|
||
dist-dependabot: | ||
# Update the dist folder for dependabot commits in the specified branch | ||
runs-on: ubuntu-latest | ||
if: inputs.dependabot-autodist == 'true' && github.actor == 'dependabot[bot]' && github.event_name == 'push' && github.ref == 'refs/heads/${{ inputs.dependabot-branch }}' | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Setup Node" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ github.event.inputs.node-version }} | ||
|
||
- name: "Install and Build" | ||
run: | | ||
npm install | ||
npm run bundle --if-present | ||
npm run bundle-exe --if-present | ||
|
||
- name: Check that build is clean | ||
id: clean_build | ||
continue-on-error: true | ||
run: | | ||
git diff --exit-code | ||
|
||
- name: Update release | ||
if: steps.clean_build.outcome == 'failure' | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
|
||
git add . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you know this to be the |
||
git commit -m "chore: Updating release files" | ||
git push origin ${{ github.head_ref }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This job does not depend on the other, is that intentional? If so it is kind of doing what the other one is with a little more, so why the two?