Skip to content

langtags-deployed

langtags-deployed #116

Workflow file for this run

name: Build and deploy
on:
push:
branches: [ "main", "release" ]
paths-ignore:
- kubernetes/**
- test/**
- testdata/**
- README.md
repository_dispatch:
types:
- langtags-deployed
- families-updated
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value={{date 'GGWWEHHmm'}}
type=raw,value=latest
labels: |
org.opencontainers.image.description=Find-a-Font REST API endpoint service
# Build and push Docker image with Buildx (don't push on PR)
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: ${{ (github.event.client_payload.release || endsWith(github.ref, '/release')) && 'production' || 'staging' }}
url: https://lff${{ (github.event.client_payload.release || endsWith(github.ref, '/release')) && '.api' || '' }}.languagetechnology.org/docs
steps:
- name: Deploy to ${{ (github.event.client_payload.release || endsWith(github.ref, '/release')) && 'production' || 'staging' }}
uses: drlove2002/secure-github-webhook@0.3.0
with:
url: ${{ secrets.DEPLOY_WEBHOOK_URL }}
hmacSecret: ${{ secrets.DEPLOY_KEY }}
data: >-
{
"action" : "push",
"ref" : "${{ github.ref }}"
}