78 lines
2.3 KiB
YAML
78 lines
2.3 KiB
YAML
name: Emails Build
|
|
on: pull_request
|
|
|
|
# Cancel in progress workflows on pull_requests.
|
|
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# In order to be able to have required checks, a workflow can't be entirely
|
|
# skipped: see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
|
|
paths-filter:
|
|
name: "Changed files?"
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matches: ${{ steps.filter.outputs.matches }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2 # important, to fetch previous commit
|
|
|
|
# workaround for https://github.com/dorny/paths-filter/issues/240
|
|
- id: previous-sha
|
|
run: 'echo "sha=$(git rev-parse HEAD^1)" >> $GITHUB_OUTPUT'
|
|
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
base: "${{ steps.previous-sha.outputs.sha }}"
|
|
filters: |
|
|
matches:
|
|
- 'emails/**'
|
|
- '.github/workflows/emails-build.yaml'
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
needs: paths-filter
|
|
if: needs.paths-filter.outputs.matches == 'true'
|
|
strategy:
|
|
matrix:
|
|
node: [20, 22]
|
|
steps:
|
|
# Setup:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.head_ref }}
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: "yarn"
|
|
cache-dependency-path: emails/yarn.lock
|
|
|
|
- name: Install dependencies
|
|
working-directory: emails
|
|
env:
|
|
HUSKY: 0
|
|
run: yarn install --frozen-lockfile
|
|
|
|
# Check build:
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
driver-opts: network=host
|
|
|
|
- name: Build Email Service
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: emails
|
|
load: true
|
|
tags: webrecorder/browsertrix-emails:latest
|
|
cache-from: type=gha,scope=emails
|
|
cache-to: type=gha,scope=emails,mode=max
|