|
| 1 | +name: Deploy to LexImpact Legislation Explorer |
| 2 | + |
| 3 | +on: |
| 4 | + - push |
| 5 | + - workflow_dispatch |
| 6 | + |
| 7 | +jobs: |
| 8 | + deploy_parameters: |
| 9 | + if: github.ref == 'refs/heads/wip-leximpact' |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Clone Legislation Parameters Explorer |
| 15 | + run: git clone https://git.leximpact.dev/leximpact/legislation-parameters-explorer.git |
| 16 | + - name: Install Node.js version LTS |
| 17 | + uses: actions/setup-node@v4 |
| 18 | + with: |
| 19 | + node-version: "lts/*" |
| 20 | + - name: Install viewer dependencies |
| 21 | + run: npm install |
| 22 | + working-directory: legislation-parameters-explorer/packages/viewer |
| 23 | + - name: Configure viewer |
| 24 | + run: | |
| 25 | + rm -f .env |
| 26 | + cat > .env << EOF |
| 27 | + # Customizations to apply to the site (theme, URLs…) |
| 28 | + CUSTOMIZATION="leximpact" |
| 29 | +
|
| 30 | + EDITOR_URL="https://editeur.legislation.leximpact.dev/" |
| 31 | +
|
| 32 | + EXPORT_CSV=true |
| 33 | + EXPORT_JSON=false |
| 34 | + EXPORT_XLSX=true |
| 35 | +
|
| 36 | + # Path of directory containing legislation parameters of country |
| 37 | + PARAMETERS_DIR="../../../openfisca_france/parameters/" |
| 38 | +
|
| 39 | + # Description of parameters remote repository |
| 40 | + PARAMETERS_AUTHOR_EMAIL="editeur.legislation@leximpact.dev" |
| 41 | + PARAMETERS_AUTHOR_NAME="Éditeur LexImpact" |
| 42 | + PARAMETERS_BRANCH="wip-leximpact" |
| 43 | + PARAMETERS_FORGE_DOMAIN_NAME="github.com" |
| 44 | + PARAMETERS_FORGE_TYPE="GitHub" |
| 45 | + PARAMETERS_GROUP="openfisca" |
| 46 | + PARAMETERS_PROJECT="openfisca-france" |
| 47 | + PARAMETERS_PROJECT_DIR="openfisca_france/parameters" |
| 48 | +
|
| 49 | + SHOW_LAST_BREADCRUMB_ITEM = false |
| 50 | +
|
| 51 | + TABLE_OF_CONTENTS_DIR="../../../openfisca_france/tables/" |
| 52 | +
|
| 53 | + TITLE="Législation du système fiscal et social" |
| 54 | +
|
| 55 | + # Path of file containing units used by French legislation parameters |
| 56 | + UNITS_FILE_PATH="../../../openfisca_france/units.yaml" |
| 57 | + EOF |
| 58 | + working-directory: legislation-parameters-explorer/packages/viewer |
| 59 | + - name: Initialize .svelte-kit directory of viewer |
| 60 | + run: npx svelte-kit sync |
| 61 | + working-directory: legislation-parameters-explorer/packages/viewer |
| 62 | + - name: Generate viewer data |
| 63 | + run: npx tsx src/scripts/generate_data.ts |
| 64 | + working-directory: legislation-parameters-explorer/packages/viewer |
| 65 | + - name: Build viewer |
| 66 | + run: npm run build |
| 67 | + working-directory: legislation-parameters-explorer/packages/viewer |
| 68 | + - name: Configure ssh for deployment to server |
| 69 | + uses: tanmancan/action-setup-ssh-agent-key@1.0.0 |
| 70 | + with: |
| 71 | + ssh-auth-sock: /tmp/my_auth.sock |
| 72 | + ssh-private-key: ${{ secrets.PARAMETERS_EXPLORER_SSH_PRIVATE_KEY }} |
| 73 | + ssh-public-key: ${{ secrets.PARAMETERS_EXPLORER_SSH_KNOWN_HOSTS }} |
| 74 | + - name: Deploy to Server using rsync |
| 75 | + run: rsync -az --delete build/ legislation@legislation.leximpact.dev:legislation-parameters-explorer-france/packages/viewer/build/ |
| 76 | + working-directory: legislation-parameters-explorer/packages/viewer |
| 77 | + - name: Update editor parameters data |
| 78 | + run: ssh legislation@legislation.leximpact.dev "cd openfisca-france && git fetch && git reset --hard origin/leximpact_legislation_explorer && sudo systemctl restart legislation-edit.service" |
0 commit comments