Skip to content

feat: auto build

feat: auto build #16

Workflow file for this run

name: Build
on:
push:
branches:
- main
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Filter changed paths
id: filter
uses: dorny/paths-filter@v3
with:
list-files: json
filters: |
account: "account/server/**"
auth: "auth/server/**"
- name: Generate matrix dynamically
id: set-matrix
run: |

Check failure on line 28 in .github/workflows/build.yaml

View workflow run for this annotation

GitHub Actions / Build

Invalid workflow file

The workflow is not valid. .github/workflows/build.yaml (Line: 28, Col: 14): Unrecognized named-value: 'service'. Located at position 22 within expression: steps.filter.outputs[service]
matrix=()
for service in $(jq -r 'keys[]' <<< '${{ toJson(steps.filter.outputs) }}'); do
if [[ "${{ steps.filter.outputs[service] }}" == "true" ]]; then
matrix+=("\"$service\"")
fi
done
echo "matrix={\"APP_DIR\":[$(IFS=,; echo "${matrix[*]}")]}" >> $GITHUB_ENV
build:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.matrix != '{}' }}
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to the Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
push: true
tags: ghcr.io/noah-platform/noah/${{ matrix.APP_DIR }}:latest
build-args: |
APP_DIR=${{ matrix.APP_DIR }}
cache-from: type=gha
cache-to: type=gha,mode=max