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: Build and Push Modeling Commons Images | |
| on: | |
| push: | |
| branches: [main, app/modeling-commons] | |
| paths: | |
| - 'apps/modeling-commons-backend/**' | |
| - 'apps/modeling-commons-frontend/**' | |
| - 'packages/modeling-commons-shared/**' | |
| - 'packages/typescript-config/**' | |
| - 'packages/tailwind-config/**' | |
| - 'packages/nuxt-core/**' | |
| - 'packages/vue-ui/**' | |
| - 'packages/markdown/**' | |
| - 'packages/eslint-config/**' | |
| - 'packages/utils/**' | |
| - 'packages/common-data/**' | |
| - 'packages/template/**' | |
| - 'packages/nuxt-content-assets/**' | |
| - 'packages/netlogo-docs/**' | |
| - 'yarn.lock' | |
| workflow_dispatch: | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| environment: netlogo1 | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Sanitize repo slug | |
| uses: actions/github-script@v8 | |
| id: repo_slug | |
| with: | |
| result-encoding: string | |
| script: return 'ghcr.io/${{ github.repository }}'.toLowerCase() | |
| - name: Build and push backend image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./apps/modeling-commons-backend/Dockerfile | |
| push: true | |
| tags: | | |
| # need github.repository to be lowercase for ghcr.io | |
| ${{ steps.repo_slug.outputs.result }}/modeling-commons-backend:${{ github.sha }} | |
| ${{ steps.repo_slug.outputs.result }}/modeling-commons-backend:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build and push frontend image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./apps/modeling-commons-frontend/Dockerfile | |
| push: true | |
| tags: | | |
| ${{ steps.repo_slug.outputs.result }}/modeling-commons-frontend:${{ github.sha }} | |
| ${{ steps.repo_slug.outputs.result }}/modeling-commons-frontend:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |