chore(deps-dev): Bump globals from 15.15.0 to 17.4.0 (#2135) #124
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'Build, Test, Release' | |
| permissions: | |
| id-token: write # Required for NPM trusted publishing | |
| contents: write | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| env: | |
| DOCKER_IMAGE_NAME: maptiler/tileserver-gl | |
| LOCAL_LIGHT_IMAGE_NAME: maptiler/tileserver-gl-light | |
| jobs: | |
| release-check: | |
| name: Check if version is published | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: 'package.json' | |
| check-latest: true | |
| cache: 'npm' | |
| - name: Check if version is published | |
| id: check | |
| run: | | |
| currentVersion="$( node -e "console.log(require('./package.json').version)" )" | |
| isPublished="$( npm view tileserver-gl versions --json | jq -c --arg cv "$currentVersion" 'any(. == $cv)' )" | |
| echo "version=$currentVersion" >> "$GITHUB_OUTPUT" | |
| echo "published=$isPublished" >> "$GITHUB_OUTPUT" | |
| echo "currentVersion: $currentVersion" | |
| echo "isPublished: $isPublished" | |
| outputs: | |
| published: ${{ steps.check.outputs.published }} | |
| version: ${{ steps.check.outputs.version }} | |
| # Build and push individual architecture images (with tests) | |
| build_arch_images: | |
| name: Test and Build ${{ matrix.arch }} Image | |
| runs-on: ${{ matrix.runs-on }} | |
| needs: release-check | |
| if: ${{ needs.release-check.outputs.published == 'false' }} | |
| environment: release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runs-on: ubuntu-24.04 | |
| arch: amd64 | |
| - runs-on: ubuntu-24.04-arm | |
| arch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup node env 📦 | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: 'package.json' | |
| check-latest: true | |
| cache: 'npm' | |
| - name: Install dependencies (Ubuntu) 🚀 | |
| run: >- | |
| sudo apt-get update -qq && sudo apt-get install -qq libcairo2-dev libpng-dev libjpeg-dev libgif-dev | |
| libpango1.0-dev libicu-dev build-essential g++ xvfb libgles2-mesa-dev libgbm-dev libxxf86vm-dev | |
| - name: Install NPM dependencies 🚀 | |
| run: npm ci --prefer-offline --no-audit | |
| - name: Rebuild canvas from source 🎨 | |
| run: npm rebuild canvas --build-from-source | |
| - name: Pull test data 📦 | |
| run: >- | |
| wget -O test_data.zip | |
| https://github.com/maptiler/tileserver-gl/releases/download/v1.3.0/test_data.zip | |
| - name: Prepare test data 📦 | |
| run: unzip -q test_data.zip -d test_data | |
| - name: Run tests 🧪 | |
| run: xvfb-run --server-args="-screen 0 1024x768x24" npm test | |
| - name: Remove Test Data | |
| run: rm -R test_data* | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKER_USER }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Get release info | |
| id: release_info | |
| run: | | |
| PACKAGE_VERSION="${{ needs.release-check.outputs.version }}" | |
| RELEASE_TYPE="$(node -e "const semver = require('semver'); const prerelease = semver.prerelease('$PACKAGE_VERSION'); console.log(prerelease ? 'prerelease' : 'regular')")" | |
| echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "RELEASE_TYPE=$RELEASE_TYPE" >> "$GITHUB_OUTPUT" | |
| # Build and Push Main Image | |
| - name: Build and Push Main ${{ matrix.arch }} Image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/${{ matrix.arch }} | |
| tags: | | |
| ${{ env.DOCKER_IMAGE_NAME }}:v${{ steps.release_info.outputs.PACKAGE_VERSION }}-${{ matrix.arch }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Build and Push Light Image | |
| - name: Create Tileserver Light Directory | |
| run: node publish.js --no-publish | |
| - name: Install Light NPM dependencies | |
| run: npm ci --prefer-offline --no-audit | |
| working-directory: ./light | |
| - name: Build and Push Light ${{ matrix.arch }} Image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ./light | |
| file: ./light/Dockerfile | |
| push: true | |
| platforms: linux/${{ matrix.arch }} | |
| tags: | | |
| ${{ env.LOCAL_LIGHT_IMAGE_NAME }}:v${{ steps.release_info.outputs.PACKAGE_VERSION }}-${{ matrix.arch }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Create manifests, publish NPM, and create GitHub release | |
| release: | |
| name: Release | |
| runs-on: ubuntu-24.04 | |
| needs: [release-check, build_arch_images] | |
| if: ${{ needs.release-check.outputs.published == 'false' }} | |
| environment: release | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup node env 📦 | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: 'package.json' | |
| check-latest: true | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install NPM dependencies 🚀 | |
| run: npm ci --prefer-offline --no-audit | |
| - name: Get release type | |
| id: prepare_release | |
| run: | | |
| VERSION="${{ needs.release-check.outputs.version }}" | |
| if [[ "$VERSION" == *-* ]]; then | |
| echo "prerelease=true" >> "$GITHUB_OUTPUT" | |
| echo "tag=next" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "prerelease=false" >> "$GITHUB_OUTPUT" | |
| echo "tag=latest" >> "$GITHUB_OUTPUT" | |
| fi | |
| # NPM Publishing | |
| - name: Publish to NPM | |
| run: | | |
| npm publish --access public --tag ${{ steps.prepare_release.outputs.tag }} | |
| - name: Create Tileserver Light Directory | |
| run: node publish.js --no-publish | |
| - name: Install Light NPM dependencies | |
| run: npm ci --prefer-offline --no-audit | |
| working-directory: ./light | |
| - name: Publish Light to NPM | |
| working-directory: ./light | |
| run: | | |
| npm publish --access public --tag ${{ steps.prepare_release.outputs.tag }} | |
| # Docker Manifest Creation | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKER_USER }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Create and push Main Multi-Arch Manifest | |
| run: | | |
| PACKAGE_VERSION="${{ needs.release-check.outputs.version }}" | |
| docker buildx imagetools create \ | |
| --tag "${{ env.DOCKER_IMAGE_NAME }}:${{ steps.prepare_release.outputs.tag }}" \ | |
| --tag "${{ env.DOCKER_IMAGE_NAME }}:v${PACKAGE_VERSION}" \ | |
| "${{ env.DOCKER_IMAGE_NAME }}:v${PACKAGE_VERSION}-amd64" \ | |
| "${{ env.DOCKER_IMAGE_NAME }}:v${PACKAGE_VERSION}-arm64" | |
| - name: Create and push Light Multi-Arch Manifest | |
| run: | | |
| PACKAGE_VERSION="${{ needs.release-check.outputs.version }}" | |
| docker buildx imagetools create \ | |
| --tag "${{ env.LOCAL_LIGHT_IMAGE_NAME }}:${{ steps.prepare_release.outputs.tag }}" \ | |
| --tag "${{ env.LOCAL_LIGHT_IMAGE_NAME }}:v${PACKAGE_VERSION}" \ | |
| "${{ env.LOCAL_LIGHT_IMAGE_NAME }}:v${PACKAGE_VERSION}-amd64" \ | |
| "${{ env.LOCAL_LIGHT_IMAGE_NAME }}:v${PACKAGE_VERSION}-arm64" | |
| # GitHub Release | |
| - name: Extract changelog for version | |
| run: | | |
| VERSION="${{ needs.release-check.outputs.version }}" | |
| awk -v ver="## $VERSION" 'BEGIN{p=0} $0==ver{p=1; next} /^## / && p==1{exit} p==1{print}' CHANGELOG.md > changelog_for_version.md | |
| if [ ! -s changelog_for_version.md ]; then | |
| echo "No changelog found for version $VERSION" > changelog_for_version.md | |
| fi | |
| cat changelog_for_version.md | |
| - name: Publish to GitHub Release | |
| uses: ncipollo/release-action@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag: v${{ needs.release-check.outputs.version }} | |
| name: v${{ needs.release-check.outputs.version }} | |
| bodyFile: changelog_for_version.md | |
| allowUpdates: true | |
| draft: false | |
| prerelease: ${{ steps.prepare_release.outputs.prerelease }} |