Skip to content

Update dependency mapbox-gl to ^3.8.0 (#331) #324

Update dependency mapbox-gl to ^3.8.0 (#331)

Update dependency mapbox-gl to ^3.8.0 (#331) #324

Workflow file for this run

name: Build and Tests
on:
push:
branches: ['main']
permissions:
contents: read
pages: write
id-token: write
jobs:
preconditions:
runs-on: ubuntu-latest
outputs:
repo_name: ${{ steps.repo_ids.outputs.REPO_NAME }}
org_name: ${{ steps.repo_ids.outputs.ORG_NAME }}
steps:
- name: Check npmjs token
run: |
if [ -z "${{ secrets.NPM_TOKEN }}"]; then
echo "Must provide a NPM_TOKEN secret in order to run release workflow"
exit 1
fi
lint:
name: Run lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install Packages
run: npm install
- name: Build
run: npm run build
- name: Lint
run: npm run lint
dependency-check:
name: Run dependency check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install Packages
run: npm ci
- name: Dependency Check
run: npm run depcheck
check-version:
name: 'Check version'
runs-on: ubuntu-latest
outputs:
is_new_version: ${{ steps.get_version.outputs.IS_NEW_VERSION }}
version: ${{ steps.get_version.outputs.VERSION }}
build_date: ${{ steps.get_version.outputs.BUILD_DATE }}
is_prerelease: ${{ steps.get_version.outputs.IS_PRERELEASE }}
steps:
- uses: actions/checkout@v4
- run: git fetch --depth=1 --tags origin
- name: Install yq
run: sudo snap install yq
- name: Check Build Version
id: get_version
run: ./scripts/check-version.sh
shell: bash
- name: Skipping release as version has not increased
if: steps.get_version.outputs.IS_NEW_VERSION != 'true'
shell: bash
run: |
echo "Skipping release as current version has already been published"
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install Packages
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm run test
publish-npm:
name: 'Publish package to NPMJS'
needs:
- preconditions
- lint
- dependency-check
- test
- check-version
runs-on: ubuntu-latest
if: ${{ needs.check-version.outputs.is_new_version == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
scope: '@digicatapult'
- name: Install Packages
run: npm ci
- name: Build
run: npm run build
- name: Publish to npmjs packages
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
deploy-pages:
name: 'Deploy Storybook to Github pages'
needs:
- preconditions
- lint
- dependency-check
- test
- check-version
runs-on: ubuntu-latest
if: ${{ needs.check-version.outputs.is_new_version == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
scope: '@digicatapult'
- name: Install Packages
run: npm ci
- name: Build
run: npm run storybook:build
- name: Upload github pages artifact
uses: actions/upload-pages-artifact@main
with:
path: build
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4