Skip to content

Commit

Permalink
build(node): Switch build to Node v18 (#26)
Browse files Browse the repository at this point in the history
* Update mlc_config.json

* Add cache cleanup

* Change node version to 18

* Bump wrangler

* Bump packages

* Update build.yml
  • Loading branch information
ankurdotb authored Nov 8, 2022
1 parent d0578e1 commit f6fd387
Show file tree
Hide file tree
Showing 10 changed files with 371 additions and 274 deletions.
12 changes: 11 additions & 1 deletion .github/linters/mlc_config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
{
"aliveStatusCodes": [0, 200, 206, 403, 999]
"aliveStatusCodes": [0, 200, 206, 429, 403, 501, 999],
"replacementPatterns": [
{
"pattern": "\" %}",
"replacement": ""
},
{
"pattern": "" %}",
"replacement": ""
}
]
}
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ defaults:

jobs:
build:
name: "Build Node.js"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/cleanup-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Cleanup - Actions"
on:
workflow_dispatch:
inputs:
days:
description: 'Retain days'
required: true
type: string
default: 30
minimum_runs:
description: 'Minimum runs to keep for each workflow'
required: true
type: string
default: 0
delete_workflow_pattern:
description: 'Name/filename of workflow. Default is all.'
required: false
type: string
delete_workflow_by_state_pattern:
description: 'Remove workflow by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually'
required: true
default: All
type: choice
options:
- All
- active
- deleted
- disabled_inactivity
- disabled_manually

jobs:

delete-runs:
name: "Delete old workflow runs"
runs-on: ubuntu-latest

steps:
- uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: ${{ github.event.inputs.days }}
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }}
24 changes: 24 additions & 0 deletions .github/workflows/cleanup-cache-automatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: "Cache Cleanup - Automatic"
on:
pull_request:
types:
- closed
defaults:
run:
shell: bash


jobs:

cache-purge:
name: "Purge Actions cache"
runs-on: ubuntu-latest

steps:

- name: "Delete Branch Cache Action"
uses: snnaplab/delete-branch-cache-action@v1.0.0
with:
# Specify explicitly because the ref at the time of merging will be a branch name such as 'main', 'develop'
ref: refs/pull/${{ github.event.number }}/merge
github-token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/cleanup-cache-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Cache Cleanup - Manual"
on:
workflow_dispatch:
inputs:
dry-run:
description: "Dry run only?"
required: true
type: boolean
default: false

jobs:

delete-caches:
name: "Delete Actions caches"
runs-on: ubuntu-latest

steps:
- name: "Wipe Github Actions cache"
uses: easimon/wipe-cache@v1
with:
dry-run: ${{ github.event.inputs.dry-run }}
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

Expand All @@ -29,7 +29,7 @@ jobs:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
environment: "staging"
wranglerVersion: '2.0.27'
wranglerVersion: '2.0.29'
preCommands: npm ci
command: publish --env staging
secrets: |
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
with:
config-file: '.github/linters/mlc_config.json'
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'

super-lint:
name: "Super Linter"
Expand All @@ -46,8 +45,6 @@ jobs:
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_JSONC: true
VALIDATE_MARKDOWN: true
VALIDATE_OPENAPI: true
VALIDATE_TSX: true
VALIDATE_TYPESCRIPT_ES: true
VALIDATE_XML: true
VALIDATE_YAML: true
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

Expand All @@ -63,7 +63,7 @@ jobs:
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
wranglerVersion: '2.0.27'
wranglerVersion: '2.0.29'
preCommands: npm ci
command: publish
secrets: |
Expand Down
Loading

0 comments on commit f6fd387

Please sign in to comment.