Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build and deploy

on:
push:
branches: [main]

workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy (leave empty for all)'
required: false
default: ''
type: choice
options:
- ''

Check failure on line 15 in .github/workflows/build-and-deploy.yml

View workflow job for this annotation

GitHub Actions / actionlint

string should not be empty
- dev
- staging
- prod

jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |

Check failure on line 27 in .github/workflows/build-and-deploy.yml

View workflow job for this annotation

GitHub Actions / actionlint

shellcheck reported issue in this script: SC2086:info:4:70: Double quote to prevent globbing and word splitting

Check failure on line 27 in .github/workflows/build-and-deploy.yml

View workflow job for this annotation

GitHub Actions / actionlint

shellcheck reported issue in this script: SC2086:info:2:81: Double quote to prevent globbing and word splitting
if [ -z "${{ inputs.environment }}" ]; then
echo 'matrix={"include":[{"env":"dev"},{"env":"staging"},{"env":"prod"}]}' >> $GITHUB_OUTPUT
else
echo 'matrix={"include":[{"env":"${{ inputs.environment }}"}]}' >> $GITHUB_OUTPUT
fi

build:
needs: setup-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
uses: ./.github/workflows/reusable-build.yml
secrets: inherit
with:
environment: ${{ matrix.env }}
build-command: ${{ matrix.env == 'prod' && 'build' || format('build:{0}', matrix.env) }}
artifact-name: ${{ matrix.env }}

build-storybook:
needs: setup-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
uses: ./.github/workflows/reusable-build-storybook.yml
secrets: inherit
with:
environment: ${{ matrix.env }}
artifact-name: ${{ matrix.env }}

upload-sourcemaps:
needs: [setup-matrix, build]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
uses: ./.github/workflows/reusable-upload-sourcemaps.yml
secrets: inherit
with:
environment: ${{ matrix.env }}
artifact-name: ${{ matrix.env }}

upload-code:
needs: [setup-matrix, build, build-storybook]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
uses: ./.github/workflows/reusable-upload-code.yml
secrets: inherit
with:
environment: ${{ matrix.env }}
artifact-name: ${{ matrix.env }}
s3-destination: ${{ format('s3://permanent-repos/{0}/mdot.tar.gz', matrix.env) }}

deploy:
needs: [setup-matrix, upload-code, upload-sourcemaps]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
environment: ${{ matrix.env }}
steps:
- name: Trigger ${{ matrix.env }} deploy
if: matrix.env == 'dev'
run: |
curl -X POST \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: Bearer ${{ secrets.PERMANENT_DEPLOY_PAT }}' \
https://api.github.com/repos/PermanentOrg/infrastructure/actions/workflows/deploy-dev.yml/dispatches \
-d '{"ref":"main"}'
51 changes: 0 additions & 51 deletions .github/workflows/build-dev.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/build-prod.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/build-staging.yml

This file was deleted.

75 changes: 0 additions & 75 deletions .github/workflows/build.yml

This file was deleted.

29 changes: 28 additions & 1 deletion .github/workflows/lint.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: lint
name: CI

on:
pull_request:
workflow_dispatch:
Expand All @@ -19,30 +20,56 @@ jobs:
node-version-file: .node-version
- name: Lint GitHub Action workflows
uses: raven-actions/actionlint@v2

eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: 'npm'
- run: npm ci
- run: npm run lint:eslint

prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: 'npm'
- run: npm ci
- run: npm run lint:prettier

tsc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: 'npm'
- run: npm ci
- run: npm run lint:tsc

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version-file: .node-version
cache: 'npm'
- run: npm ci
- name: Run unit tests
env:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY_DEV }}
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY_DEV }}
STRIPE_API_KEY: ${{ secrets.STRIPE_TEST_KEY }}
run: npm run coverage:ci
- name: Upload report to codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
Loading
Loading