This repository has been archived by the owner on Nov 6, 2024. It is now read-only.
Deploy to GitHub pages #912
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
name: Deploy to GitHub pages | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [ main ] | |
schedule: | |
- cron: '0 6 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
jobs: | |
create-artifacts: | |
name: Create entity relationship artifacts | |
runs-on: ubuntu-latest | |
env: | |
RAILS_ENV: test | |
DB_USERNAME: postgres | |
DB_PASSWORD: postgres | |
DB_HOSTNAME: localhost | |
DB_PORT: 5432 | |
ANALYTICS_DB_USERNAME: postgres | |
ANALYTICS_DB_PASSWORD: postgres | |
ANALYTICS_DB_HOSTNAME: localhost | |
ANALYTICS_DB_PORT: 5432 | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
repository: DFE-Digital/early-careers-framework | |
- name: Setup Graphviz | |
uses: ts-graphviz/setup-graphviz@v1 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: '3.2.2' | |
- name: Install rails-erd | |
run: | | |
bundle config unset deployment | |
bundle add rails-erd | |
- name: Set up test database | |
run: bin/rails db:create db:schema:load | |
- name: create erd config file | |
uses: DamianReeves/[email protected] | |
with: | |
path: ./.erdconfig | |
contents: | | |
attributes: | |
- content | |
disconnected: false | |
filename: tmp/entity-relationship-diagram | |
filetype: pdf | |
indirect: false | |
inheritance: false | |
markup: true | |
notation: bachman | |
orientation: vertical | |
polymorphism: false | |
sort: true | |
warn: false | |
title: Teacher Continuing Professional Development - ERD | |
exclude: | |
- Record | |
- ApplicationRecord | |
- DiscardableRecord | |
- Item | |
- ApiToken | |
- NPQRegistrationApiToken | |
- EngageAndLearnApiToken | |
- LeadProviderApiToken | |
- DataStudioApiToken | |
- PaperTrail::Version | |
- ActiveRecord::SessionStore::Session | |
- ActiveStorage::Record | |
- ActiveStorage::Blob | |
- ActiveStorage::VariantRecord | |
- ActiveStorage::Attachment | |
- Delayed::Backend::ActiveRecord::Job | |
- Analytics::BaseRecord | |
- Feature | |
- Feature::SelectedObject | |
- DataStage::SchoolLink | |
- DataStage::School | |
- DataStage::SchoolChange | |
- ActionMailbox::Record | |
- ActionMailbox::InboundEmail | |
- AdminProfile | |
- AdditionalSchoolEmail | |
- NominationEmail | |
- PartnershipNotificationEmail | |
- PartnershipCsvUpload | |
- PrivacyPolicy::Acceptance | |
- PrivacyPolicy | |
- Email::Association | |
- Owner | |
- EventLog | |
- ApiRequest | |
- ApiRequestAudit | |
- InductionCoordinatorProfile | |
- FinanceProfile | |
- LeadProviderProfile | |
- DeliveryPartnerProfile | |
- InductionCoordinatorProfilesSchool | |
- Finance::Statement::ECF::Paid | |
- Finance::Statement::ECF::Payable | |
- Finance::Statement::NPQ::Paid | |
- Finance::Statement::NPQ::Payable | |
- Finance::Schedule::NPQLeadership | |
- Finance::Schedule::NPQSpecialist | |
- Finance::Schedule::NPQSupport | |
- Finance::Schedule::ECF | |
- Finance::Schedule::Mentor | |
- Finance::Schedule::NPQ | |
- Finance::Schedule::NPQEhco | |
only: null | |
only_recursion_depth: null | |
prepend_primary: false | |
cluster: true | |
splines: curved | |
write-mode: overwrite | |
- name: Create ERD DOT | |
run: bundle exec erd --filetype=dot | |
- name: Create ERD PDF | |
run: bundle exec erd --filetype=pdf | |
- name: Create ERD PNG | |
run: bundle exec erd --filetype=png | |
- name: Publish diagrams | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Teacher CPD - entity relationship Diagram | |
path: ./tmp/entity-relationship-diagram.* | |
update-diagrams: | |
if: ${{ github.event_name != 'pull_request' }} | |
name: Update entity relationship artifacts | |
runs-on: ubuntu-latest | |
needs: create-artifacts | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get diagrams | |
uses: actions/download-artifact@v2 | |
with: | |
name: Teacher CPD - entity relationship Diagram | |
path: ./source/images | |
- name: Push updated diagram | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
git add . | |
git commit -m "updated entity relationship diagram" | |
git push origin | |
build-and-push: | |
if: ${{ github.event_name != 'pull_request' }} | |
name: Build and deploy service manual | |
runs-on: ubuntu-latest | |
needs: update-diagrams | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: '3.2.2' | |
# - name: Validate C4 Models | |
# run: ./bin/c4-validate.sh | |
# continue-on-error: true | |
# | |
# - name: Generate C4 Views | |
# run: ./bin/c4-to-plantuml.sh | |
# | |
# - name: Generate Images and documents for C4 views | |
# run: ./bin/plantuml-to-png.sh | |
- name: Build docs with middleman | |
run: make build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: 'build' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |