build(firebase): update firebase deployment configs (#852) #243
This file contains 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
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: trunk | |
on: | |
push: | |
branches: [main] | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
group: ${{ github.ref_name }}.${{ github.sha }}.trunk | |
cancel-in-progress: true | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
outputs: | |
changes: ${{ steps.check-changes.outputs.changes }} | |
deploy: ${{ steps.check-changes.outputs.deploy }} | |
origin: ${{ steps.check-origin.outputs.origin }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Setup environment | |
uses: ./.github/actions/setup-environment | |
- name: Check changes | |
id: check-changes | |
uses: ./.github/actions/check-changes | |
- name: Check origin | |
id: check-origin | |
uses: ./.github/actions/check-origin | |
trunk: | |
needs: checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup environment | |
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' || fromJSON(needs.checks.outputs.changes).shelltools == 'true' }} | |
uses: ./.github/actions/setup-environment | |
with: | |
compodoc: true | |
cypress: true | |
firebase-tools: true | |
- name: Lint shell | |
if: fromJSON(needs.checks.outputs.changes).shelltools == 'true' | |
run: | | |
sudo apt install shellcheck | |
npx nx run tools:lint-shell | |
- name: Lint ts | |
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }} | |
run: npx nx run-many --target lint --all | |
- name: Lint html | |
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }} | |
run: npx nx run-many --target prettier-check --dryRun --all | |
- name: Lint scss | |
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }} | |
run: npx nx run-many --target stylelint-check --dryRun --all | |
- name: Unit test | |
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' }} | |
run: | | |
npx nx run-many --target test --all --pass-with-no-tests --code-coverage --run-in-band --ci | |
npx nx run tools:coverage-stats | |
cat ./UNIT_COVERAGE.md >> $GITHUB_STEP_SUMMARY | |
- name: Build | |
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }} | |
run: | | |
yarn generate:env:documentation | |
npx nx run-many --target configure-env --all --parallel 1 | |
npx nx run-many --target build --all --parallel 1 --configuration production | |
npx nx run-many --target configure-env --all --parallel 1 --reset | |
- name: Documentation assets | |
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }} | |
run: | | |
bash tools/shell/test.sh reports || exit 1 | |
yarn generate:unit-test-coverage-index | |
npx nx run tools:compodoc-build | |
cp -r ./dist/compodoc ./dist/apps/documentation/browser/assets | |
yarn generate:changelog | |
npx nx run-many --target e2e --all --parallel 1 | |
bash tools/shell/e2e.sh reports || exit 1 | |
yarn generate:e2e-test-report-index | |
npx nx run documentation:build-storybook | |
cp -r ./dist/storybook/documentation ./dist/apps/documentation/browser/assets/storybook | |
- name: Upload dist artifact | |
if: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' || fromJSON(needs.checks.outputs.changes).storybook == 'true' }} | |
uses: ./.github/actions/dist-artifact-upload | |
- name: Cleanup | |
run: rm -rf ./.env ./functions/.env | |
deploy-apps: | |
needs: [checks, trunk] | |
if: ${{ needs.checks.outputs.origin == 'true' && fromJSON(needs.checks.outputs.changes).deploy == 'true' }} | |
uses: ./.github/workflows/deploy-apps.yml | |
secrets: inherit | |
with: | |
api: false # This only works with a paid plan such as Blaze (https://firebase.google.com/pricing/) | |
client: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' }} | |
elements: ${{ fromJSON(needs.checks.outputs.changes).dependencies == 'true' || fromJSON(needs.checks.outputs.changes).src == 'true' }} | |
documentation: ${{ fromJSON(needs.checks.outputs.changes).deploy == 'true' }} | |
publish-packages: | |
needs: [checks, trunk] | |
if: ${{ needs.checks.outputs.origin == 'true' && fromJSON(needs.checks.outputs.changes).packages == 'true' }} | |
uses: ./.github/workflows/publish-packages.yml | |
secrets: inherit |