Bump @vitejs/plugin-react from 4.7.0 to 6.0.3 #371
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: CI | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DEFAULT_TARGET: spectra | |
| IMAGE_NAME: ${{ github.repository }} | |
| REGISTRY: ghcr.io | |
| DOCKER_METADATA_LABELS: | | |
| org.opencontainers.image.description=Spectra Search Interface | |
| org.opencontainers.image.licenses=MIT | |
| org.opencontainers.image.title=spectra-search | |
| org.opencontainers.image.url=https://github.com/h2020charisma/spectrasearch/blob/main/README.md | |
| org.opencontainers.image.vendor=IDEAconsult | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7.0.0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6.0.9 | |
| - name: Read Node.js version from Dockerfile | |
| id: node-version | |
| run: | | |
| node_image="$( | |
| awk ' | |
| $1 == "FROM" && | |
| $2 ~ /^node:[0-9]+\.[0-9]+\.[0-9]+-slim$/ && | |
| $3 == "AS" && | |
| $4 == "build-stage" { | |
| print $2 | |
| exit | |
| } | |
| ' Dockerfile | |
| )" | |
| node_version="${node_image#node:}" | |
| node_version="${node_version%-slim}" | |
| if [ -z "${node_version}" ]; then | |
| echo "Could not determine Node.js version from Dockerfile" >&2 | |
| exit 1 | |
| fi | |
| echo "version=${node_version}" >> "${GITHUB_OUTPUT}" | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6.4.0 | |
| with: | |
| node-version: ${{ steps.node-version.outputs.version }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Set a fake .env file | |
| run: printf '%s\n' 'VITE_BaseURL="http://localhost:8080/"' > .env | |
| - name: Run Cypress | |
| uses: cypress-io/github-action@v7.4.0 | |
| with: | |
| install: false | |
| start: pnpm build-serve | |
| wait-on: http://127.0.0.1:50722/search/ | |
| docker-pr-preview: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - check | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| target: &docker-targets | |
| - tag: spectra | |
| url: https://api.ramanchada.ideaconsult.net/ | |
| - tag: nambit | |
| url: https://api.nambit.adma.ai/ | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7.0.0 | |
| - name: Setup Docker buildx | |
| uses: docker/setup-buildx-action@v4.1.0 | |
| - name: Log into registry ${{ env.REGISTRY }} | |
| uses: docker/login-action@v4.2.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v6.1.0 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| labels: ${{ env.DOCKER_METADATA_LABELS }} | |
| tags: | | |
| type=raw,value=pr-${{ github.event.pull_request.number }}-${{ matrix.target.tag }} | |
| type=raw,value=pr-${{ github.event.pull_request.number }}-${{ github.sha }}-${{ matrix.target.tag }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v7.2.0 | |
| with: | |
| build-args: | | |
| VITE_BaseURL=${{ matrix.target.url }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| context: . | |
| labels: ${{ steps.meta.outputs.labels }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| docker-release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - check | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| timeout-minutes: 45 | |
| permissions: | |
| contents: read | |
| packages: write | |
| # This is used to complete the identity challenge | |
| # with sigstore/fulcio for production images. | |
| id-token: write | |
| strategy: | |
| matrix: | |
| target: *docker-targets | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7.0.0 | |
| - name: Install cosign | |
| uses: sigstore/cosign-installer@v4.1.2 | |
| - name: Setup Docker buildx | |
| uses: docker/setup-buildx-action@v4.1.0 | |
| - name: Log into registry ${{ env.REGISTRY }} | |
| uses: docker/login-action@v4.2.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v6.1.0 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| labels: ${{ env.DOCKER_METADATA_LABELS }} | |
| tags: | | |
| type=raw,value=latest,enable=${{ matrix.target.tag == env.DEFAULT_TARGET }} | |
| type=raw,value=${{ matrix.target.tag }} | |
| type=raw,value=main-${{ matrix.target.tag }} | |
| type=raw,value=sha-${{ github.sha }}-${{ matrix.target.tag }} | |
| - name: Build and push Docker image | |
| id: build-and-push | |
| uses: docker/build-push-action@v7.2.0 | |
| with: | |
| build-args: | | |
| VITE_BaseURL=${{ matrix.target.url }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| context: . | |
| labels: ${{ steps.meta.outputs.labels }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| - name: Sign the published Docker image | |
| env: | |
| TAGS: ${{ steps.meta.outputs.tags }} | |
| DIGEST: ${{ steps.build-and-push.outputs.digest }} | |
| # This step uses the identity token to provision an ephemeral certificate | |
| # against the sigstore community Fulcio instance. | |
| run: printf '%s\n' "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} |