feat: carto default page (#522) #105
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: Release and publish | |
on: | |
push: | |
branches: | |
- 'publish' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
prettier: | |
name: Prettier | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Prettier | |
run: yarn prettier --check . | |
eslint: | |
name: ESLint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Lint | |
run: yarn lint client-application | |
stylelint: | |
name: Stylelint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Lint | |
run: yarn stylelint "projects/client-application/**/*.scss" | |
commitlint: | |
name: CommitLint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Lint | |
run: | | |
cd projects/client-application | |
npx commitlint --from origin/main | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Test | |
run: yarn test client-application | |
build-client-application: | |
name: Build Client Application | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Set fonts paths | |
run: | | |
cd projects/client-application | |
eval PACKAGE_VERSION=$(npm pkg get version) | |
defaultMainFontPath=$(grep font-path-main src/scss/variables/_fonts.scss) | |
newMainFontPath='$font-path-main: "https://cdn.jsdelivr.net/npm/@gouvfr-anct/cartographie-nationale'@$PACKAGE_VERSION'/assets/fonts/";' | |
sed -i "s|$defaultMainFontPath|$newMainFontPath|g" src/scss/variables/_fonts.scss | |
defaultIconFontPath=$(grep font-path-icons src/scss/variables/_icons.scss) | |
newIconFontPath='$font-path-icons: "https://cdn.jsdelivr.net/npm/@gouvfr-anct/cartographie-nationale'@$PACKAGE_VERSION'/assets/fonts/";' | |
sed -i "s|$defaultIconFontPath|$newIconFontPath|g" src/scss/variables/_icons.scss | |
- name: Build | |
run: yarn build client-application --named-chunks --output-hashing none | |
- name: Add readme, license and package files | |
run: | | |
mv projects/client-application/README.md dist/client-application/ | |
mv projects/client-application/LICENSE.md dist/client-application/ | |
mv projects/client-application/package.json dist/client-application/ | |
- name: Merge all script files | |
run: cat dist/client-application/*.js > dist/client-application/script.js | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
build-mediation-numerique-web-component: | |
name: Build Mediation Numerique Web Component | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: yarn build mediation-numerique --named-chunks --output-hashing none | |
- name: Merge all script files | |
run: cat dist/mediation-numerique/*.js > dist/mediation-numerique/script.js | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
build-cartographie-web-component: | |
name: Build Cartographie Web Component | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: yarn build cartographie --named-chunks --output-hashing none | |
- name: Merge all script files | |
run: cat dist/cartographie/*.js > dist/cartographie/script.js | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
build-orientation-web-component: | |
name: Build Orientation Web Component | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: yarn build orientation --named-chunks --output-hashing none | |
- name: Merge all script files | |
run: cat dist/orientation/*.js > dist/orientation/script.js | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
build-coordinateurs-web-component: | |
name: Build Coordinateurs Web Component | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project workspace repository | |
uses: actions/checkout@v3 | |
with: | |
repository: anct-cartographie-nationale/client-base | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
with: | |
path: projects/client-application | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: yarn build coordinateurs --named-chunks --output-hashing none | |
- name: Merge all script files | |
run: cat dist/coordinateurs/*.js > dist/coordinateurs/script.js | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
prettier, | |
eslint, | |
stylelint, | |
commitlint, | |
test, | |
build-client-application, | |
build-mediation-numerique-web-component, | |
build-cartographie-web-component, | |
build-orientation-web-component, | |
build-coordinateurs-web-component | |
] | |
steps: | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
- name: Download build artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: dist | |
- name: Add readme, license and package files | |
run: | | |
mkdir dist/whitelist | |
mkdir dist/whitelist/assets | |
mv README.md dist/whitelist/ | |
mv LICENSE.md dist/whitelist/ | |
mv package.json dist/whitelist/ | |
mv dist/client-application/assets/data/ dist/whitelist/assets/data/ | |
mv dist/client-application/assets/fonts/ dist/whitelist/assets/fonts/ | |
mv dist/client-application/assets/img/ dist/whitelist/assets/img/ | |
mv dist/client-application/styles.css dist/whitelist/styles.css | |
mv dist/mediation-numerique/script.js dist/whitelist/mediation-numerique.js | |
mv dist/cartographie/script.js dist/whitelist/cartographie.js | |
mv dist/orientation/script.js dist/whitelist/orientation.js | |
mv dist/coordinateurs/script.js dist/whitelist/coordinateurs.js | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: dist | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: [release] | |
steps: | |
- name: Checkout client-application repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
- name: Download build artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: release | |
# Using a symbolic link because there is no base option to have a config path with semantic-release as of 2022-08-31 | |
- name: Link the semantic release config and release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
run: | | |
cd release/whitelist/ | |
ln -s ../../.tooling/.semantic-release/.semantic-release.config.cjs release.config.cjs | |
ln -s ../../.tooling/.semantic-release/.npmignore .npmignore | |
npx semantic-release |