Skip to content

generate types

generate types #32

Workflow file for this run

name: CI
on:
push:
release:
types: [published]
permissions:
id-token: write
contents: read
env:
# Change this to upload the built image to your own organization.
docker_tag_prefix: ghcr.io/tietokilta
jobs:
build:
strategy:
matrix:
project: [web, cms]
name: Format, Lint, Check types & Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./${{matrix.project}}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: ./${{matrix.project}}/package-lock.json
- name: build strapi plugin
if: matrix.project == 'cms'
working-directory: ./cms/src/plugins/management
run: npm install && npm run build
- name: build project
run: npm install && npm run build
docker-build-and-push:
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && github.event.action == 'published')
needs: build
strategy:
matrix:
project: [web, cms]
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{env.docker_tag_prefix}}/${{matrix.project == 'web' && 'm0-frontend' || 'm0-strapi'}}
tags: |
type=semver,pattern={{version}},enable=${{ github.ref_type == 'tag' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ github.ref_type == 'tag' }}
type=raw,value=sha-${{github.sha}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Push to GitHub Packages
uses: docker/build-push-action@v5
with:
context: ${{matrix.project}}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max