Fix GitHub actions to work a little better
This commit is contained in:
parent
a4db1a1116
commit
57c331c6b4
9 changed files with 102 additions and 70 deletions
21
.github/actions/setup/action.yml
vendored
21
.github/actions/setup/action.yml
vendored
|
|
@ -1,21 +0,0 @@
|
||||||
# In the future, I'd like to fold this into its own action under the Mithril.js
|
|
||||||
# org and include `actions/checkout` as well. It'd simplify maintenance a bit
|
|
||||||
# and I could reuse it across multiple repos.
|
|
||||||
name: Setup CI context
|
|
||||||
description: Sets up repo and Node context and installs packages
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
# See supported Node.js release schedule here:
|
|
||||||
# https://github.com/nodejs/Release
|
|
||||||
node-version:
|
|
||||||
default: 20
|
|
||||||
description: The Node version to use
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ inputs.node-version }}
|
|
||||||
- run: npm ci
|
|
||||||
shell: bash
|
|
||||||
38
.github/workflows/_npm-task.yml
vendored
Normal file
38
.github/workflows/_npm-task.yml
vendored
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
name: Run npm task
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
task:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
node-version:
|
||||||
|
type: number
|
||||||
|
default: 20
|
||||||
|
continue-on-error:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
# This uses actions/checkout instead of `git clone` directly since it's way
|
||||||
|
# easier than parsing everything out.
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-task:
|
||||||
|
name: npm run ${{ inputs.task }}
|
||||||
|
continue-on-error: ${{ inputs.continue-on-error }}
|
||||||
|
runs-on:
|
||||||
|
- ubuntu-latest
|
||||||
|
- windows-latest
|
||||||
|
- macos-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ inputs.node-version }}
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run ${{ inputs.task }}
|
||||||
21
.github/workflows/_post-comment.yml
vendored
Normal file
21
.github/workflows/_post-comment.yml
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
name: Post comment
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
url:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
notify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: gh issue comment "$ISSUE_URL" --body "$MESSAGE"
|
||||||
|
env:
|
||||||
|
ISSUE_URL: ${{ inputs.url }}
|
||||||
|
MESSAGE: ${{ inputs.message }}
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
13
.github/workflows/issue-create.yml
vendored
13
.github/workflows/issue-create.yml
vendored
|
|
@ -1,13 +1,12 @@
|
||||||
name: Ping triage on issue create
|
name: Ping triage on issue create
|
||||||
|
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types: [opened]
|
types: [opened]
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
jobs:
|
jobs:
|
||||||
notify:
|
notify:
|
||||||
runs-on: ubuntu-latest
|
uses: ./.github/workflows/_post-comment.yml
|
||||||
steps:
|
with:
|
||||||
- run: gh issue comment ${{ github.event.issue.url }} --body '@MithrilJS/triage Please take a look.'
|
url: ${{ github.event.issue.url }}
|
||||||
env:
|
message: '@MithrilJS/triage Please take a look.'
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
|
|
|
||||||
9
.github/workflows/merge.yml
vendored
9
.github/workflows/merge.yml
vendored
|
|
@ -13,8 +13,13 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: git clone --depth=1 https://github.com/MithrilJS/mithril.js.git && cd mithril.js
|
- uses: actions/checkout@v4
|
||||||
- uses: ./.github/actions/setup
|
with:
|
||||||
|
ref: next
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx pr-release merge --target master --source next --commit --force --clean --changelog ./docs/recent-changes.md --compact --minimize-semver-change
|
- run: npx pr-release merge --target master --source next --commit --force --clean --changelog ./docs/recent-changes.md --compact --minimize-semver-change
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
12
.github/workflows/push-master.yml
vendored
12
.github/workflows/push-master.yml
vendored
|
|
@ -7,11 +7,7 @@ permissions:
|
||||||
issues: write
|
issues: write
|
||||||
jobs:
|
jobs:
|
||||||
comment:
|
comment:
|
||||||
runs-on: ubuntu-latest
|
uses: ./.github/workflows/_post-comment.yml
|
||||||
steps:
|
with:
|
||||||
- run: |
|
url: ${{ github.event.pull_request.url }}
|
||||||
gh issue comment ${{ github.event.pull_request.url }} \
|
message: ⚠⚠⚠ Hey @${{ github.actor }}, did you mean to open this against `next`? ⚠⚠⚠
|
||||||
--body '⚠⚠⚠ Hey @${{ github.actor }}, did you mean to open this against `next`? ⚠⚠⚠'
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
name: Post alert comment
|
|
||||||
|
|
|
||||||
7
.github/workflows/rollback.yml
vendored
7
.github/workflows/rollback.yml
vendored
|
|
@ -10,8 +10,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- run: git clone --depth=1 https://github.com/MithrilJS/mithril.js.git && cd mithril.js
|
- uses: actions/checkout@v4
|
||||||
- uses: ./.github/actions/setup
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx pr-release rollback --verbose --target master --source next --verbose --ignore 'package*' --ignore docs/changelog.md --ignore docs/recent-changes.md
|
- run: npx pr-release rollback --verbose --target master --source next --verbose --ignore 'package*' --ignore docs/changelog.md --ignore docs/recent-changes.md
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
11
.github/workflows/test-next-push.yml
vendored
11
.github/workflows/test-next-push.yml
vendored
|
|
@ -8,15 +8,18 @@ on:
|
||||||
concurrency: prr:pre-release
|
concurrency: prr:pre-release
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
uses: ./.github/workflows/test.yml
|
uses: ./.github/workflows/test.yml
|
||||||
|
|
||||||
publish-prerelease:
|
publish-prerelease:
|
||||||
needs: build
|
needs: test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- run: git clone --depth=1 https://github.com/MithrilJS/mithril.js.git && cd mithril.js
|
- uses: actions/checkout@v4
|
||||||
- uses: ./.github/actions/setup
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npx pr-release pr --verbose --target master --source next --compact --verbose --minimize-semver-change
|
- run: npx pr-release pr --verbose --target master --source next --compact --verbose --minimize-semver-change
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
40
.github/workflows/test.yml
vendored
40
.github/workflows/test.yml
vendored
|
|
@ -15,34 +15,24 @@ permissions:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-docs:
|
lint-docs:
|
||||||
# https://github.com/MithrilJS/mithril.js/issues/2898
|
uses: ./.github/workflows/_npm-task.yml
|
||||||
# Semantics aren't quite what I'd prefer. This is what I'd really want:
|
with:
|
||||||
# https://github.com/actions/runner/issues/2347#issue-comment-box
|
task: lint:docs
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: ./.github/actions/setup
|
|
||||||
- run: npm run lint:docs
|
|
||||||
|
|
||||||
lint-js:
|
lint-js:
|
||||||
runs-on: ubuntu-latest
|
uses: ./.github/workflows/_npm-task.yml
|
||||||
steps:
|
with:
|
||||||
- uses: actions/checkout@v4
|
task: lint:js
|
||||||
- uses: ./.github/actions/setup
|
|
||||||
- run: npm run lint:js
|
|
||||||
|
|
||||||
build-js:
|
build-js:
|
||||||
needs: lint-js
|
needs: lint-js
|
||||||
runs-on: ubuntu-latest
|
uses: ./.github/workflows/_npm-task.yml
|
||||||
steps:
|
with:
|
||||||
- uses: actions/checkout@v4
|
task: build
|
||||||
- uses: ./.github/actions/setup
|
|
||||||
- run: npm run build
|
|
||||||
|
|
||||||
test-js:
|
test-js:
|
||||||
needs: build-js
|
needs: build-js
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
|
@ -51,9 +41,7 @@ jobs:
|
||||||
- 18
|
- 18
|
||||||
- 20
|
- 20
|
||||||
- 22
|
- 22
|
||||||
steps:
|
uses: ./.github/workflows/_npm-task.yml
|
||||||
- uses: actions/checkout@v4
|
with:
|
||||||
- uses: ./.github/actions/setup
|
node-version: ${{ matrix.node-version }}
|
||||||
with:
|
task: test:js
|
||||||
node-version: ${{ matrix.node-version }}
|
|
||||||
- run: npm run test:js
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue