build: update the dependencies #80
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
name: openapi | |
on: | |
push: | |
paths: | |
- 'openapi/**' | |
- '.github/workflows/openapi.yml' | |
pull_request: | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: CarloMicieli/trenako-openapi | |
jobs: | |
validate: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Setup node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install openapi-generator-cli | |
run: npm install @openapitools/openapi-generator-cli -g | |
- name: openapi-generator-cli version | |
run: openapi-generator-cli version | |
- name: Validate the openapi schema | |
run: openapi-generator-cli validate -i openapi/openapi.yaml | |
docker: | |
runs-on: ubuntu-22.04 | |
needs: validate | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- 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 }} | |
tags: | | |
# set latest tag for default branch | |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: docker/openapi.dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |