Skip to content

ci: update nightly workflow (#237) #210

ci: update nightly workflow (#237)

ci: update nightly workflow (#237) #210

Workflow file for this run

---
name: Transform and publish
on:
push:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and upload artifact
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Upload build bundle as artifact
uses: actions/upload-artifact@v4
with:
name: bundle
path: |
!assets
package.json
dist
publish:
name: Publish package to npm
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Download release artifact
uses: actions/download-artifact@v4
with:
name: bundle
- name: Link the semantic release config and release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
run: |
ln -s .tooling/.semantic-release/.semantic-release.config.cjs release.config.cjs
ln -s .tooling/.semantic-release/.npmignore .npmignore
npx semantic-release
process-data:
name: Process data
uses: ./.github/workflows/process-data.reusable.yml
with:
sources: '[
"aidants-connect",
"aix-en-provence",
"angers",
"bus-france-services-charente",
"charente-maritime",
"conseiller-numerique",
"coop-numerique",
"corse",
"dora",
"epernay",
"etapes-numerique",
"fibre-64",
"france-services",
"francil-in",
"gironde",
"grand-paris-sud",
"haute-vienne",
"hinaura",
"hub-bretagne",
"hub-lo",
"la-creuse",
"le-havre",
"les-landes",
"loire-atlantique",
"maine-et-loire",
"mednum-bfc",
"mulhouse",
"nouvelle-caledonie",
"vendee",
"paca",
"rhin-occ",
"siilab"
]'
environment: production
secrets:
DATA_INCLUSION_API_KEY: ${{ secrets.DATA_INCLUSION_API_KEY }}
DATA_GOUV_API_URL: ${{ secrets.DATA_GOUV_API_URL }}
DATA_GOUV_API_KEY: ${{ secrets.DATA_GOUV_API_KEY }}
DATA_GOUV_REFERENCE_ID: ${{ secrets.DATA_GOUV_REFERENCE_ID }}
DATA_GOUV_REFERENCE_TYPE: ${{ secrets.DATA_GOUV_REFERENCE_TYPE }}
upload-to-database:
name: Upload data to database
runs-on: ubuntu-latest
needs: process-data
steps:
- name: Download deduplicated data
uses: actions/download-artifact@v4
with:
path: deduplicated
merge-multiple: true
- name: Publish to dynamoDB via S3
uses: kersvers/s3-sync-with-cloudfront-invalidation@v1.0.0
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_DYNAMODB_BUCKET }}
DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
SOURCE_DIR: 'deduplicated/dynamo-import'
publish-to-data-gouv:
name: Get lieux from API and publish to data.gouv
runs-on: ubuntu-latest
environment: production
needs:
- upload-to-database
steps:
- name: Sleep for 4 minutes
run: sleep 240s
shell: bash
- name: Checkout mednum-cli repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: latest
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: 'Create env file'
run: |
touch .env
echo DATA_GOUV_API_URL="${{ secrets.DATA_GOUV_API_URL }}" >> .env
echo DATA_GOUV_API_KEY="${{ secrets.DATA_GOUV_API_KEY }}" >> .env
echo DATA_GOUV_REFERENCE_ID="${{ secrets.DATA_GOUV_REFERENCE_ID }}" >> .env
echo DATA_GOUV_REFERENCE_TYPE="${{ secrets.DATA_GOUV_REFERENCE_TYPE }}" >> .env
echo CARTOGRAPHIE_NATIONALE_API_URL="${{ secrets.CARTOGRAPHIE_NATIONALE_API_URL }}" >> .env
- name: Extract
run: pnpm extract.all
- name: Publish
run: pnpm publier.all
publish-to-s3:
name: Get lieux from API and publish to S3
runs-on: ubuntu-latest
needs:
- upload-to-database
steps:
- name: Sleep for 4 minutes
run: sleep 240s
shell: bash
- name: Prepare lieux inclusion numerique file
run: |
mkdir mkdir -p client-application/assets/data
curl https://cartographie.societenumerique.gouv.fr/api/v0/lieux-inclusion-numerique | gunzip >> ./client-application/assets/data/lieux-inclusion-numerique.json
- name: Publish to S3
uses: kersvers/s3-sync-with-cloudfront-invalidation@v1.0.0
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
DISTRIBUTION_ID: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
SOURCE_DIR: 'client-application'