name: Frontend Pipeline on: workflow_call: inputs: task-version: required: true type: string outputs: pipeline-success: value: ${{ jobs.notify-success.outputs.pipeline_success }} env: CI: 1 defaults: run: working-directory: frontend jobs: setup: runs-on: ubuntu-latest name: Setup steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/setup-frontend-environment with: task-version: ${{ inputs.task-version }} lint: runs-on: ubuntu-latest name: Lint needs: setup steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/setup-frontend-environment with: task-version: ${{ inputs.task-version }} - name: Lint run: task fe:lint test: runs-on: ubuntu-latest name: Test needs: setup steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/setup-frontend-environment with: task-version: ${{ inputs.task-version }} - name: Test run: task fe:test typecheck: runs-on: ubuntu-latest name: Typecheck needs: setup steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/setup-frontend-environment with: task-version: ${{ inputs.task-version }} - name: Typecheck run: task fe:typecheck build: runs-on: ubuntu-latest name: Build App needs: setup steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/setup-frontend-environment with: task-version: ${{ inputs.task-version }} - name: Parcel cache uses: actions/cache@v4 id: parcel-cache-restore with: path: | frontend/.parcel-cache key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}-parcel - run: task fe:build - name: Build Artifacts uses: actions/upload-artifact@v4 with: name: build-artifacts path: packages/app/dist preview: runs-on: ubuntu-latest name: Deploy preview if: ${{ false && github.ref != 'refs/heads/main' }} needs: build steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/setup-frontend-environment with: task-version: ${{ inputs.task-version }} - name: Build Artifacts uses: actions/download-artifact@v4 with: name: build-artifacts path: packages/app/dist - name: Deploy id: preview-deploy env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} run: | yarn netlify deploy --dir=packages/app/dist --json | jq .deploy_url > output.log echo "::set-output name=draft-url::$(cat output.log)" - name: Report uses: actions/github-script@v7 env: DRAFT_URL: ${{ steps.preview-deploy.outputs.draft-url }} with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: `:eyes: Branch deployed at ${process.env.DRAFT_URL}` }) notify-success: runs-on: ubuntu-latest name: Notify success needs: [lint, test, typecheck, build] steps: - id: set-output working-directory: / run: echo "pipeline_success=true" >> "$GITHUB_OUTPUT" outputs: pipeline_success: ${{ steps.set-output.outputs.pipeline_success }} fe-deploy: runs-on: ubuntu-latest name: Deploy needs: build if: ${{ false }} steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/setup-frontend-environment with: task-version: ${{ inputs.task-version }} - name: Build Artifacts uses: actions/download-artifact@v4 with: name: build-artifacts path: packages/app/dist - name: Netlify CLI setup run: npm install -g netlify-cli - name: Deploy id: preview-deploy env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} run: | yarn netlify deploy --dir=packages/app/dist --prod