build: add Pipeline GitHub Action workflow(s)

Signed-off-by: Vinayak Kulkarni <19776877+vinayakkulkarni@users.noreply.github.com>
This commit is contained in:
Vinayak Kulkarni 2022-08-08 18:59:41 +05:30
parent a7af45ee3f
commit 88fa33a478
No known key found for this signature in database
GPG key ID: 0FE8ABF8260A1552
5 changed files with 180 additions and 0 deletions

18
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
commit-message:
prefix: fix
prefix-development: chore
include: scope
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: weekly
commit-message:
prefix: fix
prefix-development: chore
include: scope

15
.github/workflows/automerge.yml vendored Normal file
View file

@ -0,0 +1,15 @@
name: 'Auto Merge PRs'
on:
workflow_call:
jobs:
automerge:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

51
.github/workflows/builder.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: 'Setup Docker Image(s)'
on:
workflow_call:
inputs:
branch:
description: 'The branch for the workflow'
default: 'dev'
required: true
type: string
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository 🎉
uses: actions/checkout@v3
- 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:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_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 push Docker image 🦾
uses: docker/build-push-action@v3.1.1
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.branch }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}

54
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,54 @@
name: 'Continuous Integration'
on:
workflow_call:
permissions:
checks: write
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Check out repository ✨ (non-dependabot)
if: ${{ github.actor != 'dependabot[bot]' }}
uses: actions/checkout@v3
- name: Check out repository 🎉 (dependabot)
if: ${{ github.actor == 'dependabot[bot]' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup node env 📦
uses: actions/setup-node@v3
with:
node-version: 10
- name: Install dependencies 🚀
run: npm i --prefer-offline --no-audit --omit=optional
- name: Run linter(s) 💅
uses: wearerequired/lint-action@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
continue_on_error: false
git_name: github-actions[bot]
git_email: github-actions[bot]@users.noreply.github.com
auto_fix: false
prettier: true
prettier_extensions: js,cjs,ts,json
- name: Run hadolint 🐳
uses: hadolint/hadolint-action@v2.1.0
with:
dockerfile: Dockerfile
ignore: DL3003,DL3008
# - name: Run tests 🧪
# run: npm run test

42
.github/workflows/pipeline.yml vendored Normal file
View file

@ -0,0 +1,42 @@
name: 'The Pipeline'
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
extract-branch:
name: 'Fetch branch'
runs-on: ubuntu-latest
outputs:
current_branch: ${{ steps.get-branch.outputs.current_branch }}
steps:
- name: Extract branch name 🕊
id: get-branch
run: echo "::set-output name=current_branch::${GITHUB_REF##*/}"
ci:
name: 'CI'
needs:
- extract-branch
uses: maptiler/tileserver-gl/.github/workflows/ci.yml@main
automerger:
name: 'Auto Merge Bot PRs'
needs:
- ci
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' }}
uses: maptiler/tileserver-gl/.github/workflows/automerger.yml@main
builder:
name: 'Build & Publish Docker Image(s)'
needs:
- extract-branch
- ci
if: ${{ github.event_name == 'push' }}
uses: maptiler/tileserver-gl/.github/workflows/builder.yml@main
with:
branch: ${{ needs.extract-branch.outputs.current_branch }}