-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
- Loading branch information
1 parent
47ffbd6
commit 823fb03
Showing
2 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
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 |
This file contains 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