Autour Handler #181
Workflow file for this run
This file contains hidden or 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
| name: Autour Handler | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ "handler-autour-[0-9]+.[0-9]+.[0-9]+" ] | |
| paths: [ "handlers/autour-handler/**" ] | |
| pull_request: | |
| branches: [ main ] | |
| paths: [ "handlers/autour-handler/**" ] | |
| workflow_run: | |
| workflows: [ "Schemas (Trigger)" ] | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: shared-reality-lab/image-handler-autour | |
| jobs: | |
| lint: | |
| name: Basic linting and type checking. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: '16' | |
| - name: Copy schemas | |
| working-directory: ./handlers/autour-handler | |
| run: cp -R ../../schemas src/ | |
| - name: Copy config | |
| working-directory: ./handlers/autour-handler | |
| run: cp -R ../../config src/ | |
| - name: Install dependencies | |
| working-directory: ./handlers/autour-handler | |
| run: npm ci | |
| - name: Check with tsc | |
| working-directory: ./handlers/autour-handler | |
| run: npx tsc --noEmit | |
| build-and-push-image: | |
| name: Build and Push to Registry | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Log into GHCR | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get Correct Tags | |
| run: | | |
| if [[ ${{ github.ref }} =~ ^refs/tags/handler-autour-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "TAGGED=true" >> $GITHUB_ENV | |
| else | |
| echo "TAGGED=false" >> $GITHUB_ENV | |
| fi | |
| - name: Get timestamp | |
| run: echo "timestamp=$(date -u +'%Y-%m-%dT%H.%M')" >> $GITHUB_ENV | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v4 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| flavor: | | |
| latest=${{ env.TAGGED }} | |
| tags: | | |
| type=match,enable=${{ env.TAGGED }},priority=300,pattern=handler-autour-(\d+.\d+.\d+),group=1 | |
| type=raw,priority=200,value=unstable | |
| type=raw,priority=100,value=${{ env.timestamp }} | |
| labels: | | |
| org.opencontainers.image.title=IMAGE Handler Autour | |
| org.opencontainers.image.description=Point of interest renderings for data from the autour server. | |
| org.opencontainers.image.authors=IMAGE Project <[email protected]> | |
| org.opencontainers.image.documentation=https://github.com/Shared-Reality-Lab/IMAGE-server/tree/main/handlers/autour-handler/README.md | |
| org.opencontainers.image.licenses=AGPL-3.0-or-later | |
| maintainer=IMAGE Project <[email protected]> | |
| - name: Build and push | |
| uses: docker/build-push-action@v3 | |
| with: | |
| context: . | |
| file: ./handlers/autour-handler/Dockerfile | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |