diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0a5e925..805d7bf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,7 @@ name: Deploy # About this workflow: # It is triggered on push events to branches production and testing. Then it performs a checkout of the current repo -# and sets up a node environment (v12). Following, it will run `npm ci` to build the package. Next, it will look at your +# and sets up a node environment (see .nvmrc). Following, it will run `npm ci` to build the package. Next, it will look at your # commit message, if it includes '#patch', '#minor', or '#major' it will bump the package version accordingly. # Finally, the `npm publish` command will be run, when on branch testing it will run `npm publish --tag beta` to publish # it under the beta flag on npm. Note: if no '#patch', '#minor', or '#major' flag is present in the latest commit @@ -49,7 +49,7 @@ jobs: steps: # Checks out the current repository. - name: Checkout git repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: # The token below is only necessary if you want to push the version bump to a protected branch token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }} @@ -63,16 +63,32 @@ jobs: # Configures a Node.js environment pointed at the public npm registry so # `npm publish` uses OIDC against npmjs.org. - name: Set up Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version-file: .nvmrc + cache: 'npm' registry-url: https://registry.npmjs.org - # Run `npm ci && npm run build` to re-create your local environment (make sure to commit your - package-lock.json!). - - name: Build + # OIDC trusted publishing needs npm 11.5.1 or newer. Node 22 bundles npm 10, + # and setup-node installs whatever npm ships with the Node version. + - name: Upgrade npm for trusted publishing + run: npm install -g npm@^11.5.1 + + # Run `npm ci` to re-create your local environment (make sure to commit your - package-lock.json!). + - name: Install + run: npm ci + + # Nothing below this point runs if the package does not lint, format or test + # cleanly, so a push to testing cannot publish a beta that was never checked. + # Ahead of the docs build, which is the slowest step here. + - name: Validate run: | - npm ci - npm run build + npm run lint + npm run format:check + npm test + + - name: Build + run: npm run build - name: Version bump patch if: github.event.inputs.versionBumpType == 'patch' || contains(github.event.head_commit.message, '#patch') && !contains(github.event.head_commit.message, '#minor') && !contains(github.event.head_commit.message, '#major') diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ecf72bd..1fe6073 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -27,12 +27,13 @@ jobs: name: Build & Deploy to GitHub Pages runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version-file: .nvmrc + cache: 'npm' # Build - name: Build @@ -42,7 +43,7 @@ jobs: # Deploy - name: Deploy To GitHub Pages - uses: peaceiris/actions-gh-pages@v3.8.0 + uses: peaceiris/actions-gh-pages@v4 with: personal_token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }} publish_dir: ./build diff --git a/.github/workflows/generate-types.yml b/.github/workflows/generate-types.yml index 7b6149f..3dc4791 100644 --- a/.github/workflows/generate-types.yml +++ b/.github/workflows/generate-types.yml @@ -23,13 +23,13 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: ref: ${{ github.ref_name }} token: ${{ secrets.HOMEY_GITHUB_ACTIONS_BOT_PERSONAL_ACCESS_TOKEN }} - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version-file: .nvmrc cache: 'npm' diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d94386d..39e9edd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,6 +13,7 @@ on: branches: - master - production + - testing pull_request: jobs: @@ -21,12 +22,13 @@ jobs: runs-on: ubuntu-latest steps: # Checks out the current repository. - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 # Configures a Node.js environment. - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version-file: .nvmrc + cache: 'npm' # Run `npm ci` to re-create your local environment (make sure to commit your package-lock.json!). # Finally run `npm run lint` (make sure you have defined a lint command in package.json e.g. "lint": "eslint ."). diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c345f6..540f04d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,7 @@ on: branches: - master - production + - testing pull_request: jobs: @@ -22,12 +23,13 @@ jobs: steps: # Checks out the current repository. - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 # Configures a Node.js environment. - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version-file: .nvmrc + cache: 'npm' # Run `npm ci` to re-create your local environment (make sure to commit your package-lock.json!). # Finally run `npm test` (make sure you have defined a proper test command in package.json). diff --git a/.nvmrc b/.nvmrc index a45fd52..2bd5a0a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -24 +22