chore: simplify common structure #46
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, test and publish extensions | |
| on: | |
| push: | |
| workflow_dispatch: | |
| inputs: | |
| extension_name: | |
| description: "The PostgreSQL extension to build (directory name)" | |
| required: true | |
| type: choice | |
| options: | |
| - pgvector | |
| - postgis | |
| defaults: | |
| run: | |
| shell: 'bash -Eeuo pipefail -x {0}' | |
| permissions: {} | |
| jobs: | |
| # Gather extensions that have been modified | |
| change-triage: | |
| name: Check changed files | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| matrix: ${{ steps.get-matrix.outputs.matrix}} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| with: | |
| persist-credentials: false | |
| - name: Check for changes | |
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
| id: filter | |
| with: | |
| base: ${{ (github.event_name == 'schedule') && 'main' || '' }} | |
| filters: | | |
| pgvector: | |
| - 'pgvector/**' | |
| postgis: | |
| - 'postgis/**' | |
| # Compute a matrix containing the list of all extensions that have been modified | |
| - name: Compute matrix | |
| id: get-matrix | |
| env: | |
| # JSON array containing the extensions that have been changed | |
| EXTENSIONS_CHANGED: ${{ steps.filter.outputs.changes }} | |
| # Input Extension name | |
| INPUT_EXTENSION_NAME: ${{ github.event.inputs.extension_name }} | |
| run: | | |
| if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]]; then | |
| EXTENSIONS_CHANGED="[\"$INPUT_EXTENSION_NAME\"]" | |
| fi | |
| echo "{\"name\": $EXTENSIONS_CHANGED}" > matrix.json | |
| echo "matrix=$(cat matrix.json)" >> "$GITHUB_OUTPUT" | |
| Bake: | |
| name: Bake | |
| needs: change-triage | |
| permissions: | |
| packages: write | |
| contents: read | |
| id-token: write | |
| security-events: write | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.change-triage.outputs.matrix) }} | |
| uses: ./.github/workflows/bake_targets.yml | |
| with: | |
| extension_name: ${{ matrix.name }} | |
| secrets: | |
| SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} |