125 lines
4.3 KiB
YAML
125 lines
4.3 KiB
YAML
name: 'Build, Publish & Release'
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
DOCKER_USER:
|
|
description: 'The user who pushes on Docker Hub'
|
|
required: true
|
|
DOCKER_TOKEN:
|
|
description: 'The token of the user who pushes on Docker Hub'
|
|
required: true
|
|
NPM_AUTH_TOKEN:
|
|
description: 'The token of the user who pushes on NPM'
|
|
required: true
|
|
|
|
jobs:
|
|
release-docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository 🎉
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
- name: Setup node env 📦
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: 'package.json'
|
|
check-latest: true
|
|
cache: 'npm'
|
|
- name: Get next version 🎉
|
|
run: echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1)" >> $GITHUB_ENV
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: 'arm64'
|
|
- name: Set up Docker Buildx 🏗
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
buildkitd-flags: --debug
|
|
- name: Log in to the Container registry 🔐
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ inputs.DOCKER_USER }}
|
|
password: ${{ inputs.DOCKER_TOKEN }}
|
|
- name: Extract metadata (tags, labels) for Docker 🙏🏽
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
- name: Build and publish full version to DockerHub 🦾
|
|
uses: docker/build-push-action@v3.2.0
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }},maptiler/tileserver-gl:latest, maptiler/tileserver-gl:${{ env.PACKAGE_VERSION }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/arm64,linux/amd64
|
|
release-full:
|
|
needs:
|
|
- release-docker
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository 🎉
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
- name: Setup node env 📦
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: 'package.json'
|
|
check-latest: true
|
|
cache: 'npm'
|
|
- name: Get next version 🎉
|
|
run: echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1)" >> $GITHUB_ENV
|
|
- name: Install dependencies 🚀
|
|
working-directory: ./light
|
|
run: npm i --prefer-offline --no-audit --omit=optional
|
|
- name: Publish to Full Version 🚀
|
|
run: npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
|
|
env:
|
|
NPM_TOKEN: ${{ github.event.inputs.npm_token }}
|
|
release-light:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- release-docker
|
|
steps:
|
|
- name: Check out repository 🎉
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
- name: Setup node env 📦
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version-file: 'package.json'
|
|
check-latest: true
|
|
cache: 'npm'
|
|
- name: Get next version 🎉
|
|
run: echo "PACKAGE_VERSION=$(grep '"version"' package.json | cut -d '"' -f 4 | head -n 1)" >> $GITHUB_ENV
|
|
- name: Create Light Working Directory 📁
|
|
run: node publish.js --no-publish
|
|
- name: Install dependencies 🚀
|
|
working-directory: ./light
|
|
run: npm i --prefer-offline --no-audit --omit=optional
|
|
- name: Publish to Light Version NPM
|
|
working-directory: ./light
|
|
run: npm config set //registry.npmjs.org/:_authToken ${NPM_AUTH_TOKEN}
|
|
env:
|
|
NPM_TOKEN: ${{ inputs.NPM_AUTH_TOKEN }}
|
|
- name: Set up QEMU 📦
|
|
uses: docker/setup-qemu-action@v2
|
|
with:
|
|
platforms: 'arm64'
|
|
- name: Set up Docker Buildx 🏗
|
|
uses: docker/setup-buildx-action@v2
|
|
with:
|
|
buildkitd-flags: --debug
|
|
- name: Build and publish light version to DockerHub 🦾
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: ./light
|
|
file: ./light/Dockerfile
|
|
push: true
|
|
tags: maptiler/tileserver-gl-light:latest,maptiler/tileserver-gl-light:${{ env.PACKAGE_VERSION }}
|
|
platforms: linux/arm64,linux/amd64
|