diff --git a/.github/workflows/tax-benefit.yml b/.github/workflows/tax-benefit.yml index ab3e71e..31a8944 100644 --- a/.github/workflows/tax-benefit.yml +++ b/.github/workflows/tax-benefit.yml @@ -11,7 +11,80 @@ jobs: parameters_path: "openfisca_tunisia/parameters" secrets: token: ${{ secrets.CONTROL_CENTER_TOKEN }} - deploy: + + deploy_parameters: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Clone Legislation Parameters Explorer + run: git clone https://git.leximpact.dev/leximpact/legislation-parameters-explorer.git + - name: Install Node.js version LTS + uses: actions/setup-node@v4 + with: + node-version: 'lts' + - name: Install viewer dependencies + run: npm install + working-directory: legislation-parameters-explorer/packages/viewer + - name: Configure viewer + run: | + rm -f .env + cat > .env << EOF + # Customizations to apply to the site (theme, URLs…) + CUSTOMIZATION="openfisca" + + DBNOMICS_DATASET_CODE="openfisca_tunisia" + DBNOMICS_PROVIDER_CODE="OpenFisca" + DBNOMICS_URL="https://db.nomics.world/" + + EDITOR_URL="https://editors.parameters.tn.tax-benefit.org/" + + EXPORT_CSV=true + EXPORT_JSON=false + EXPORT_XLSX=true + + # Path of directory containing legislation parameters of country + PARAMETERS_DIR="../../../openfisca_tunisia/parameters/" + + # Description of parameters remote repository + PARAMETERS_AUTHOR_EMAIL="editors.parameters.tn@tax-benefit.org" + PARAMETERS_AUTHOR_NAME="Éditeur des paramètres d'OpenFisca-Tunisia" + PARAMETERS_BRANCH="master" + PARAMETERS_FORGE="gitlab.com" + PARAMETERS_GROUP="openfisca" + PARAMETERS_PROJECT="openfisca-tunisia" + PARAMETERS_PROJECT_DIR="openfisca_tunisia/parameters" + + SHOW_LAST_BREADCRUMB_ITEM = false + + # TABLE_OF_CONTENTS_DIR="../../../openfisca_tunisia/tables/" + + TITLE="OpenFisca" + + # Path of file containing units used by French legislation parameters + UNITS_FILE_PATH="../../../openfisca_tunisia/units.yaml" + EOF + working-directory: legislation-parameters-explorer/packages/viewer + - name: Initialize .svelte-kit directory of viewer + run: npx svelte-kit sync + working-directory: legislation-parameters-explorer/packages/viewer + - name: Generate data of viewer + run: npx tsx src/scripts/generate_data.ts + working-directory: legislation-parameters-explorer/packages/viewer + - name: Build viewer + run: npm run build + - name: Deploy to Server + uses: easingthemes/ssh-deploy@main + with: + SSH_PRIVATE_KEY: ${{ secrets.PARAMETERS_EXPLORER_SSH_PRIVATE_KEY }} + ARGS: "-az --delete" + REMOTE_HOST: ${{ secrets.PARAMETERS_EXPLORER_REMOTE_HOST }} + REMOTE_USER: ${{ secrets.PARAMETERS_EXPLORER_REMOTE_USER }} + SSH_CMD_ARGS: ${{ secrets.PARAMETERS_EXPLORER_SSH_CMD_ARGS }} + SOURCE: "build/" + TARGET: ${{ secrets.PARAMETERS_EXPLORER_REMOTE_TARGET }} + + deploy_simulator: uses: tax-benefit/actions/.github/workflows/deploy.yml@v2.1.0 with: python_package: "openfisca_tunisia"