Skip to content

Commit

Permalink
feat: add builder workflow 🎉
Browse files Browse the repository at this point in the history
Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
  • Loading branch information
vinayakkulkarni committed Nov 9, 2022
1 parent f29fc92 commit e47cb1d
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 0 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/builder.yml
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
11 changes: 11 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,14 @@ jobs:
needs:
- extract-branch
uses: maptiler/tileserver-gl/.github/workflows/ct.yml@master
builder:
name: 'Build, Publish & Release'
needs:
- extract-branch
- ci
- ct
uses: maptiler/tileserver-gl/.github/workflows/builder.yml@master
secrets:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

0 comments on commit e47cb1d

Please sign in to comment.