Skip to content

Commit

Permalink
Update GitHub actions (#28)
Browse files Browse the repository at this point in the history
Update `package.json`:
- Update "engines.pnpm" to only allow pnpm v9 because the lockfile
version is not compatible with pnpm v8
- Update "engines.node" to only allow Node.js 20 which is the current
LTS version. Node.js v21 is no longer officially supported.
- Add "packageManager" for use with Vercel as well as the
"pnpm/action-setup"

Update `.github/workflows/continuous-deployment.yml`:
- Remove "version" input from "pnpm/action-setup" because it will pick
up the pnpm version from package.json#packageManager

Use hashes to pin GitHub Actions to prevent tampering. Tags are added
ascomments. Dependabot will update both in pull requests.

Update all actions to their latest versions.

Make it explicit that `--frozen-lockfile` is used when running `pnpm
install` in CI.
  • Loading branch information
matijs authored May 23, 2024
1 parent 1794843 commit 60c292b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 52 deletions.
79 changes: 30 additions & 49 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@ jobs:

steps:
- name: Checkout branch
uses: actions/[email protected].2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

- name: Set up Node.js version
uses: actions/[email protected]
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm

- name: Install dependencies
run: |
pnpm install
pnpm install --frozen-lockfile
pnpm ls --recursive
lint:
Expand All @@ -36,70 +34,60 @@ jobs:

steps:
- name: Checkout branch
uses: actions/[email protected].2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

- name: Set up Node.js version
uses: actions/[email protected]
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm

- name: Install dependencies
run: |
pnpm install
run: pnpm install --frozen-lockfile

- name: "Continuous Integration: lint"
run: |
pnpm run --if-present lint
run: pnpm run --if-present lint

build:
runs-on: ubuntu-latest
needs: install

steps:
- name: Checkout branch
uses: actions/[email protected].2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

- name: Set up Node.js version
uses: actions/[email protected]
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm

- name: Install dependencies
run: |
pnpm install
run: pnpm install --frozen-lockfile

- name: "Continuous Integration: build"
env:
BASE_URL: "/utrecht/"
run: |
pnpm run --if-present build
run: pnpm run --if-present build

- name: "Continuous Integration: lint build"
env:
BASE_URL: "/utrecht/"
run: |
pnpm run --if-present lint-build
run: pnpm run --if-present lint-build

- name: "Continuous Integration: test build"
env:
BASE_URL: "/utrecht/"
run: |
pnpm run --if-present test-build
run: pnpm run --if-present test-build

- name: "Retain build artifact: storybook"
uses: actions/[email protected].1
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: storybook
path: packages/storybook/dist/
Expand All @@ -111,26 +99,22 @@ jobs:

steps:
- name: Checkout branch
uses: actions/[email protected].2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

- name: Set up Node.js version
uses: actions/[email protected]
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm

- name: Install dependencies
run: |
pnpm install
run: pnpm install --frozen-lockfile

- name: "Continuous Integration: test"
run: |
pnpm run --if-present test
run: pnpm run --if-present test

publish-website:
runs-on: ubuntu-latest
Expand All @@ -139,16 +123,16 @@ jobs:

steps:
- name: Checkout release branch
uses: actions/[email protected].2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: "Restore build artifact: Storybook"
uses: actions/[email protected].4
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: storybook
path: packages/storybook/dist/

- name: Continuous Deployment to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.5.0
uses: JamesIves/github-pages-deploy-action@5c6e9e9f3672ce8fd37b9856193d2a537941e66c # v4.6.1
with:
branch: gh-pages
folder: packages/storybook/dist/
Expand All @@ -160,29 +144,26 @@ jobs:

steps:
- name: Checkout release branch
uses: actions/[email protected].2
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
token: ${{ secrets.GH_TOKEN }}

- name: Install pnpm package manager
uses: pnpm/[email protected]
with:
version: 8.14
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0

- name: Set up Node.js version
uses: actions/[email protected]
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: .nvmrc
cache: pnpm

- name: "Continuous Deployment: install"
run: |
pnpm install
pnpm install --frozen-lockfile
pnpm ls --recursive
- name: "Continuous Deployment: build"
run: |
pnpm run --if-present build
run: pnpm run --if-present build

- name: "Continuous Deployment: publish to GitHub repository"
env:
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
],
"private": true,
"engines": {
"node": "^20 || ^21",
"pnpm": "^8 || ^9"
"node": "^20",
"pnpm": "^9"
},
"workspaces": [
"./packages/*",
Expand Down Expand Up @@ -75,5 +75,6 @@
},
"dependencies": {
"http-server": "14.1.1"
}
},
"packageManager": "[email protected]+sha256.19c17528f9ca20bd442e4ca42f00f1b9808a9cb419383cd04ba32ef19322aba7"
}

0 comments on commit 60c292b

Please sign in to comment.