From 7380f0e36c3db25a71079cb215ffdbfa2cc4bc81 Mon Sep 17 00:00:00 2001 From: Chris Pymm Date: Wed, 18 Sep 2024 11:35:26 +0100 Subject: [PATCH] ci(deployment): drop node 12 from testing matrix and tidy up workflows (#746) --- .github/workflows/deploy-production.yml | 34 +---------- .github/workflows/main.yml | 4 +- .github/workflows/publish-package.yml | 78 +++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/publish-package.yml diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index d5751ae4..c7f0fcd7 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -1,4 +1,4 @@ -name: Deploy main to production +name: Deploy guidance site on: workflow_dispatch: pull_request: @@ -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 @@ -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' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5afe0150..af04b8d3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Build, test and publish package +name: Publish package on: pull_request: @@ -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 diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml new file mode 100644 index 00000000..af04b8d3 --- /dev/null +++ b/.github/workflows/publish-package.yml @@ -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 }}