Skip to content

Commit

Permalink
ci(deployment): drop node 12 from testing matrix and tidy up workflows (
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispymm authored Sep 18, 2024
1 parent d0b8aef commit 7380f0e
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 33 deletions.
34 changes: 3 additions & 31 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy main to production
name: Deploy guidance site
on:
workflow_dispatch:
pull_request:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x, 20.x]
node-version: [14.x, 16.x, 18.x, 20.x, 21.x, 22.x]

steps:
- uses: actions/checkout@v4
Expand All @@ -55,35 +55,7 @@ jobs:
- name: Test Sass can be compiled
run: npm run test:sass

publish:
runs-on: ubuntu-latest
needs: [build, test]
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/download-artifact@v4
with:
name: mojds-package
path: package
- uses: actions/download-artifact@v4
with:
name: mojds-dist
path: dist
- run: npm ci
- name: Publish to NPM
run: npm run ci:release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

push-to-production:
deploy:
runs-on: ubuntu-latest
needs: [build, test]
if: github.event_name == 'push'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build, test and publish package
name: Publish package

on:
pull_request:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x, 20.x]
node-version: [14.x, 16.x, 18.x, 20.x, 21.x, 22.x]

steps:
- uses: actions/checkout@v4
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish package

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: npm ci
- run: npm run build:package
- uses: actions/upload-artifact@v4
with:
name: mojds-package
path: package
- run: npm run build:dist
- run: npm run build:docs
- uses: actions/upload-artifact@v4
with:
name: mojds-dist
path: dist

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

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x, 21.x, 22.x]

steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: mojds-package
path: package
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Test Sass can be compiled
run: npm run test:sass

publish:
runs-on: ubuntu-latest
needs: [build, test]
if: github.event_name == 'push'

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
- uses: actions/download-artifact@v4
with:
name: mojds-package
path: package
- uses: actions/download-artifact@v4
with:
name: mojds-dist
path: dist
- run: npm ci
- name: Publish to NPM
run: npm run ci:release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

0 comments on commit 7380f0e

Please sign in to comment.